CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2001
    Location
    Islamabad , QAU,Pakistan
    Posts
    61

    Arrow 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

  2. #2
    Join Date
    Oct 2005
    Location
    Islamabad, Pakistan
    Posts
    1,277

    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
  •  





Click Here to Expand Forum to Full Width

Featured