15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


OLE Automation Dual Interfaces

Michael R Thompson -- mike@tracker.com.au
Wednesday, May 01, 1996

Platform: Win95 & VC 4.0

Could someone please tell me what is required to support dual interfaces =
in OLE Automation using MFC. I am currently developing a set of =
automated classes (CCmdTarget derived classes) and adding properties & =
methods to these classes using ClassWizard. I have read that when =
implementing dual interfaces that the return value must be HRESULT. Does =
this mean that the methods & properties created using ClassWizard must =
all return HRESULT? Or does it mean that only the vtable implementation =
of the properties & methods need return HRESULT? All the documentation I =
have read on the subject is very vague in this area.

There is an example in VC4.1 called ACDUAL which demonstrates dual =
interfaces. However, my copy of VC 4.1 has not arrived yet and the =
example does not appear to be on the April MSDN.

Any help much appreciated.

Mike.



Mike Blaszczak -- mikeblas@interserv.com
Wednesday, May 01, 1996

[Mini-digest: 5 responses]

On Wed, 1 May 1996, Michael R Thompson  wrote:
>Platform: Win95 & VC 4.0

Thanks.

>There is an example in VC4.1 called ACDUAL which demonstrates dual =
>interfaces. However, my copy of VC 4.1 has not arrived yet and the =
>example does not appear to be on the April MSDN.

Your best bet is to wait for the sample to arrive.

.B ekiM
--
TCHAR szDisc[] = _T("These words are my own; I do not speak for Microsoft.");

-----From: "MIKEMIKE " 

Check out Q124385 "OLE Automation 94 Documentation and Samples" if you don't 
have V4.1 yet
However, the best info is in TN065: Dual-Interface Support for OLE Automation 
Servers.
As far as using Classwizard with Dual Interfaces...I wish...It's really up to 
you to create the vtable in both the ODL, and your respective Declaration and 
Implementation files.
Mike Massa
MikeMike@msn.com

TRACE("I don't even speak for myself.\n")

-----From: Frank McGeough 

HRESULT is recommended as a return code because of DCOM (Distributed COM).
In general, all COM interfaces should be designed so that they support 
distributed processing. If you define methods with return types other 
than HRESULT, COM has no way to tell return error info (like the server 
crashed or the network failed). 

The 'must' be HRESULT is too strong a way of phrasing it (unless you happen
to be laying down internal guidelines for your company). There is nothing 
in OLE that enforces this guideline. It's just the right thing to do. Even
if you are not using DCOM at this time, by using HRESULT as the return code
there is some consistency to the interfaces you'll offer when you do use
DCOM.

I'm not sure about what difference you're trying to state between an OLE
method that you define using class wizard and the underlying vtable.

__________________________________________________
Frank McGeough      frankhm@synchrologic.com
Synchrologic, Inc. (http://www.synchrologic.com/)
Voice: 404.876.3209            Fax: 404.876.3809

-----From: "Mike Ward" 

I had the same problem.  The easiest way I found was to just
implement the dispatch interfaces that Class Wizard produces and
when you're all done, go back and add the dual interface.  It's
really straight forward.  You define a new interface with the
appropriate Dual flags and then each dual function just calls the
dispatch version of the function you wrote before.  The dual
functions all return HRESULT but the last parameter in the dual
interface is always an [in,out] result parameter which is where you
return whatever the dispatch interface version returns.  The ACDUAL 
example should answer the rest of your implementation questions.

-- Mike

-----From: Steven Binney 

Dual interfaces are not directly supported by Class Wizard in VC++ 4.1.  =
ACDUAL shows how to manually modify (Class Wizard generated) ODL to add =
dual I/F support.  Hopefully, future versions of VC++ will provide =
better support.=20




MIKEMIKE@msn.com
Saturday, May 04, 1996

[Mini-digest: 2 responses]

This topic has been surely covered...however, as an added note

Check out  www.microsoft.com/oledev....Not to mention the Win32 section

But I guess the best place to start would be www.microsoft.com/devonly

-----From: Luca Orlandi 

You can pickup the sample at =
http://www.microsoft.com/kb/developr/visual_c/q140616.htm
-----
" I used to live in a Global village until they pulled it down to build =
the Information Superhighway, where I now live in a Virtual Reality"




| Вернуться в корень Архива |