Results 1 to 21 of 21

Thread: C++ DLL from VB6 (Run-time error ‘49’: Bad DLL calling convention)

Threaded View

  1. #18

    Thread Starter
    New Member
    Join Date
    Jan 2008
    Posts
    15

    Re: C++ DLL from VB6 (Run-time error ‘49’: Bad DLL calling convention)

    Quote Originally Posted by Disiance
    Could you throw a messagebox in the .NET code and see what values the two IntPtr hold?

    Second, try:
    Code:
    Public Sub LoadFromFile(ByVal BmpFile As String)
        Dim Template As Integer
        Dim Mask As Integer
        Call SomeFunction (BmpFile, VarPtr(Template), VarPtr(Mask), Width, Height)
    End Sub
    Try that with both Template and Mask as Integers and as Longs.
    I did display the IntPtr values in the .NET version when I was coding that; they were indeed big negative numbers (memory addresses) which eventually dereferenced fine using the Marhal calls.

    The VarPtr looks interesting. I tried it using your syntax, and this slightly modified version:

    Code:
    Call SomeFunction (BmpFile, VarPtr(TemplatePtr), VarPtr(MaskPtr), VarPtr(WidthPtr), VarPtr(HeightPtr))
    I still get the '49' error for both calls.

    I'll research VarPtr and see if I can learn more about it though; it does sound promising, thanks.
    Last edited by jkeller; Jan 17th, 2008 at 11:05 AM.

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