CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2002
    Posts
    41

    How to call a 'C' DLL that worked in VB6 and doesn't with Vb.net

    I have a small app that was written in vb6 that calls a DLL that was written in C. I am having trouble even getting the new vb.net app to compile, let alone run properly.

    Here is the declaration in the 'C' source (I didn't write the 'C' dll)

    extern __declspec( dllexport ) long WINAPI IS_XferImage(HWND hWnd, BYTE *data, size_t dlen);

    Here is what I did in vb.net to declare the call

    Declare Function IS_XferImage Lib "CogISCtl" Alias "_IS_XferImage@12" _
    (ByVal hWnd As Integer, ByRef data As Byte, ByVal dlen As Short) As Integer

    One of the problem I am having is getting the hWnd of the picturebox and passing it to this function.
    So I tried this
    myStatus = IS_XferImage(picture1.Handle.ToInt32, myData(myPos), maxLen)

    If I just use Picture1.Handle, I get an error. It says value of type "system pointer" cannot be converted to an integer

    Thanks for any advice

  2. #2
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868
    Looks like that should work... getting any errors?

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