Discussions related to Visual Prolog
sbishop61
Posts: 13
Joined: 9 May 2021 9:55

Com Creation

Unread post by sbishop61 »

I have used the comWrapper tool to create class and interfaces for an comDispInterface (automation) server.

The wrapped classes have zero arity constructors.
One of the classes returns an iDispatch object of the second class type. How do I create the class object from the iDispatch object?

class DVDoc
class app:getDVDoc : (integer NIndex) -> iDispatch Value.

I want to create the DVDoc object from the iDispatch returned.

Thanks,
Stephen
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Re: Com Creation

Unread post by Thomas Linder Puls »

Given that the object you "really" want is an iDVDoc object this is the safest code for your task:

Code: Select all

        IDisp = App:getDVDoc(Idx),         IDVDoc = comInterface::getFromUnknown(iDVDoc::iid, IDisp),         IDisp:release(),
Regards Thomas Linder Puls
PDC
Post Reply