CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Call own dll.

  1. #1
    Join Date
    Oct 1999
    Location
    US
    Posts
    34

    Call own dll.

    I was trying to use the dll that is not standart
    Win API dll. The function that I try to use
    declared as following.

    int FileVersion(char *filename)




    And here is how I declared it in my VB project

    Declare Function D3FileVersion
    Lib "d3libshr" (Buffer as string)
    as Integer




    And here is the error that I got
    "Bad DLL calling convention" ERRor 49
    Please tell me that doe this error mean.
    thks
    Alex!



  2. #2

    Re: Call own dll.

    I don't think a C charcter pointer translates to a VB string. However, I don't really know what it would translate to. I would try changing "as string" to "as any" and see how that goes.

    I think that the best translation for a character pointer is a byte array, so if as any doesn't work, try changing the variable to a byte array.

    C experts, help me out here -- I'm just throwing out the hacks I would try, don't know if they'll work.

    Charlie Zimmerman
    http://www.freevbcode.com


    Charlie


  3. #3
    Join Date
    May 1999
    Posts
    3,332

    Re: Call own dll.

    you should declare the string like this
    ( byval s as string )
    then, in a 32 bit DLL an int is 4 bytes. Thus you should declare the returncode of your function "As Long".


  4. #4
    Join Date
    Oct 1999
    Location
    US
    Posts
    34

    Re: Call own dll.

    It seams like byVal is the critical thing here.
    And although it generate the error it does do the
    job it suppose to do. I am trying to see why it
    doing that but it works!!!!!!!!!!!
    Thks!


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