Help with CeGetUserNotification

rimmer

New member
Joined
Jun 29, 2006
Messages
1
Programming Experience
3-5
Hi all,

I'm new so hope this is the right place to post my first question ;)
I recently upgraded to VS2005 and a little new to new VB .NET changes. My problem is converting an array or list of handles to an IntPtr for use with the CFNet function CeGetUserNotificationHandles.

The C# Declaration on MSDN for this function is:
VB.NET:
BOOL CeGetUserNotificationHandles (
HANDLE *rghNotifications, 
DWORD cHandles, 
LPDWORD pcHandlesNeeded );
Parameters Description
rghNotifications 
[in] Array of currently stored notifications. 
cHandles 
[in] Maximum number of notifications. 
pcHandlesNeeded 
[out] Pointer to the true number of notifications.

Which I have converted to VB like so:

VB.NET:
Public Declare Function CeGetUserNotificationHandles Lib "CoreDll.dll" (
ByVal rghNotifications As IntPtr,
ByVal cHandles As Integer,
ByRef pcHandlesNeeded As IntPtr) As Boolean

The function takes a Pointer to an Array of Handles (rghNotifications) but I don't have a cat's clue how to create an Array of Handles and then pass the address as an IntPtr to the function ?????

Here's what I have tried so far, without much luck:
VB.NET:
'code just for example, too much to include all
Dim dwHowMany As IntPtr
Dim dwTotalHandles As Integer = 12
Dim rghNotifications As IntPtr = AllocHLocal(dwTotalHandles * 4)
CeGetUserNotificationHandles(rghNotifications, dwTotalHandles, dwHowMany)
FreeHLocal(rghNotifications)

The code above seems to work and should fill the memory pointed to in rghNotifications with handles for use later in the following function:

VB.NET:
CeGetUserNotification(rghNotifications(handle 1 to 12), 0, dwNBytes, Nothing)

However I do not know how to access the IntPtr array as an array of handles in order to pass one of the handles to this function.
Sorry if this has been long and confusing....but.....HELP ME PLEASE :sick:
 
Back
Top