Board index » Visual Studio » CanBeDone: unmanaged IntPtr to Delegate?

CanBeDone: unmanaged IntPtr to Delegate?

Visual Studio281
Hello:

I am trying to write a wrapper for the WabApi (wich manages the Windows

Adress Book).

It uses some "kind of" interfaces, like IWABObject. But these interfaces

dont have Guids, and QueryInterface fails.

So I am thinking of getting the VTable and calling its methods.

I allready have the Vtable wich is something like this:



public structure IWABObjectVtbl

QueryInterface as IntPtr

etc.

...

end structure



The question is How can i cast the IntPtr to a delegate so I can call the

method?



Thanks a lot!!

Alejandro Lapeyre


-
 

Re:CanBeDone: unmanaged IntPtr to Delegate?

Hi,



Maybe this will help.

www.elitevb.com/content/01,0075,01/04.aspx">www.elitevb.com/content/01,0075,01/04.aspx



Ken

-----------------------

"Alejandro Lapeyre" <nospam_alejandrolapeyre@hotmail.com>wrote in message

Quote
Hello:

I am trying to write a wrapper for the WabApi (wich manages the Windows

Adress Book).

It uses some "kind of" interfaces, like IWABObject. But these interfaces

dont have Guids, and QueryInterface fails.

So I am thinking of getting the VTable and calling its methods.

I allready have the Vtable wich is something like this:



public structure IWABObjectVtbl

QueryInterface as IntPtr

etc.

...

end structure



The question is How can i cast the IntPtr to a delegate so I can call the

method?



Thanks a lot!!

Alejandro Lapeyre









-

Re:CanBeDone: unmanaged IntPtr to Delegate?

Alejandro,



Quote
The question is How can i cast the IntPtr to a delegate so I can call the

method?



That's currently not possible, but will be in Whidbey.



In the meantime, I would suggest handling things like this in a VC++

component.







Mattias



--

Mattias Sjögren [MVP] mattias @ mvps.org

www.msjogren.net/dotnet/">www.msjogren.net/dotnet/ | www.dotnetinterop.com">www.dotnetinterop.com

Please reply only to the newsgroup.

-

Re:CanBeDone: unmanaged IntPtr to Delegate?

Thank you for the answer!!!



I have never did any programming in C++ but after spending an hour I dont

find it so difficult (for this kind of small project).



Regards,

Alejandro Lapeyre.







"Mattias Sjögren" <mattias.dont.want.spam@mvps.org>escribió en el mensaje

Quote
Alejandro,



>The question is How can i cast the IntPtr to a delegate so I can call the

>method?



That's currently not possible, but will be in Whidbey.



In the meantime, I would suggest handling things like this in a VC++

component.







Mattias



--

Mattias Sjögren [MVP] mattias @ mvps.org

www.msjogren.net/dotnet/">www.msjogren.net/dotnet/ | www.dotnetinterop.com">www.dotnetinterop.com

Please reply only to the newsgroup.





-