|
-
March 8th, 2006, 06:25 AM
#1
how to use callback function in vb.net
Hi
I am trying to use a thirdparty dll which accepts function pointer as parameter. That dll is written in vc++.
I tried to use addressof operator to set the callback function but there is compile time error.... addressof expression can't be converted to system.inptr as system.inptr is not delegate type......
Anyhelp about this error......................
Thanks in advance
-
March 8th, 2006, 11:00 AM
#2
Re: how to use callback function in vb.net
in C
Code:
int LS1 (HWND hwnd, HANDLE hInst, SHORT s1, SHORT *s2);
here s2 must be passed as reference (internally VB will pass the pointer of the value)
declare in vb
Code:
Declare Function LS1 Lib "lsx.dll" _
(ByVal hWnd As IntPtr, _
ByVal hInst As IntPtr, _
ByVal s1 As Int16, _
ByRef s2 As Int16) As Int32
also look at this article Using PInvoke in VB
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|