Re:Calling OLE Automation methods at run-time
Hello,
Quote
Mike Senkovich wrote in message <36665929.4315...@forums.borland.com>...
>Many thanks to both of you for your responses.
>Using the tutorial as a guide I was able to get the DispID using
>GetIDsOfNames-- very smooth.
>It looks like I will still have to pass the GUID of the Automation
>server I want to access to GetIDsOfNames. Any ideas how to get the
>GUID if I know the ClassName of the Automation Server I want to call?
You mean the GUID parameter? Unless you implement your own GetIdsOfNames
handler on the server side, you can just pass GUID_NULL to that and it is
understood that you want the default automation interface. If you really
want to get the guids of implemented interfaces for a coclass, you can use
the ITypeInfo interface that IDispatch.GetTypeInfo returns. You have to
learn how to use ITypeInfo though. Consult the Automation Programmers
Reference (MS Press) for this.
Quote
>Also, do you know of code samples I could use as a guide to manually
>build the parameters array? I'm having a tough time figuring out what
>goes into the rgvarg, rgdispidNamedArgs, cArgs and cNamedArgs
>parameters-- I tried unsuccessfully to invoke a multiply method in a
>COM object I created-- the method just needs two integer params and
>returns an integer. I haven't found much in the Delphi help/code
>samples about TDispParams.
You can study the DispatchInvoke procedure code in ComObj.pas - its a bit
complicated. A good reference is the the Automation Programmers Reference -
examples are in C++ but should be readily translatable to Delphi.
Quote
>By the way, the tutorial is superb-- I learned quite a bit from it!
thanks
Quote
>Thanks again!
>-Mike
have fun
binh