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
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.
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