473,399 Members | 3,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

CanBeDone: unmanaged IntPtr to Delegate?

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
Nov 20 '05 #1
3 1349
Hi,

Maybe this will help.
http://www.elitevb.com/content/01,0075,01/04.aspx

Ken
-----------------------
"Alejandro Lapeyre" <no*********************@hotmail.com> wrote in message
news:eI**************@TK2MSFTNGP10.phx.gbl...
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

Nov 20 '05 #2
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
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 20 '05 #3
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" <ma********************@mvps.org> escribió en el mensaje
news:uT**************@TK2MSFTNGP09.phx.gbl...
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
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: SpookyET | last post by:
I want to create a wrapper for SQLite and I'm having a problem with getting NullReferenceException when calling the unmanaged function. I do not wish to write in C++ since i do not have enough...
1
by: Don | last post by:
I have a third party C++ DLL that I am trying to use from C#. The specific function I am trying to use is declared in C++ as follows: ladybugConvertToMultipleBGRU32( LadybugContext ...
5
by: Saya | last post by:
Hi, Please help with the following: How to implement a C++ code like this: MediaFunction( char* filename, void* info, int* size, void** buffer, int first, int* last);
13
by: Christian Westerlund | last post by:
Hi! I'm trying to use P/Invoke and a Method which takes an IntPtr where I am supposed to put an address to a method which the native method will use to communicate back to me. How do I convert a...
11
by: Joe Martin | last post by:
Has anyone made use of PKWare's PKCDL.DLL for the Implode and Explode functions? I have been able to successfully define everything correctly and even get the invoked function (Explode) to run...
5
by: Chris Kiechel | last post by:
I am writing a .NET Windows application and it needs to perform DDE calls to a legacy system. I created a C++ unmanaged class that performs the actual DDE connection and communication. However,...
0
by: Haxan | last post by:
Hi, I have an unmanaged application that converts a function pointer to a delegate and then pass this as a parameter(delegate) to a managed function which then invokes it. Currently Im able to...
6
by: Bart Burkhardt | last post by:
Hi, I could use some help in setting a C# callback function that an external unmanaged dll will call on a event. Using a delegate and use the external callback set function doesn't work. The...
17
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hi Gurus, I need to transfer a jagged array of byte by reference to unmanaged function, The unmanaged code should changed the values of the array, and when the unmanaged function returns I need...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.