Click here to Skip to main content
15,892,161 members

Comments by Dale Seeley (Top 96 by date)

Dale Seeley 14-Nov-22 22:38pm View    
Hoping your still around I have done everything you said but still getting gibberish or nothing at all.
Dale Seeley 14-Nov-22 14:18pm View    
OK I will try this once I'm home today. Would you be willing to take a look at the project if I upload it to my Google drive? If not I still thank you for all your help please let me know
Dale Seeley 14-Nov-22 3:59am View    
maybe a bit of sudo code if you could, it would go a long way in helping me to understand according to my code :) I know your basically spoon feeding me here and its honestly what i need at this point because Ive been researching this and many other things for months now and i know im very close to getting it right
Dale Seeley 14-Nov-22 3:49am View    
This is truly helpful thank you for all this so much I understand the first two replies but Marshal.StructureToPtr has me a bit confused now. I have the PINvoke FILTER_MESSAGE_HEADER no problem and also changed the lpMessageBuffer to Intptr and also created the unmanaged memory block using Marshal.AllocHGlobal(Marshal.SizeOf<filtermessageheader>()) like so..

Dim FMH As New FILTER_MESSAGE_HEADER
Dim FltMessage = Marshal.AllocHGlobal(Marshal.SizeOf(FMH))

and releasing it by calling..

Marshal.FreeHGlobal(FltMessage)

And here is the code for Marshal.StructureToPtr..


Dim FltPointer = Marshal.StructureToPtr(FMH, FltMessage, False)

If FilterGetMessage(Communication_Port_Handle, FltPointer, Marshal.SizeOf(FltMessage),
IntPtr.Zero) = True Then

Invoke(Sub() RichTextBox1.AppendText("FILTERGETMESSAGE: " & FltPointer))

End If

But this line of code errors saying expression does not produce a value
Dim FltPointer = Marshal.StructureToPtr(FMH, FltMessage, False)

thank you so much for your replys and patients.
Dale Seeley 14-Nov-22 2:42am View    
Another question my FilterGetMessage messagebuffer is intptr but the msdn shows to use FILTER_MESSAGE_HEADER for messagebuffer so how can I pass the message as intptr? or is it done in a different way?