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

    URGENT - How to pass a string to a DLL ??



    I have written a DLL using Win32 SDK . One of the exported functions in DLL takes LPCTSTR as parameter. How do I call this from VB ? If I pass a variable of type String , it gives a "Bad DLL Calling convention" error.


    Help is very much appreciated


    Thanks

    Anand

  2. #2
    Join Date
    Sep 1999
    Posts
    2

    Re: URGENT - How to pass a string to a DLL ??



    You have to pass the string to the dll ByVal So try this


    Private Declare Function MyFunction_

    Lib "MyDLL" Alias "MyDLLFunction" ( _

    ByVal lpBuffer As String )


    This should work.




  3. #3
    Join Date
    Apr 1999
    Posts
    57

    Re: URGENT - How to pass a string to a DLL ??



    Hi Hemant


    I had given the same way as you had mentioned. I didn't give an alias.

    I have a function named ExecuteCommand1 in my Dll . I have given it like this


    Public Declare Function ExecuteCommand1_

    Lib "Path of the Dll" ( _

    ByVal lpBuffer As String )


    It gives the same error " Bad DLL calling convention"


    Anand



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