Link to home
Start Free TrialLog in
Avatar of adam_pedley
adam_pedley

asked on

Passing PChar to DLL

Hi

I have a DLL that was created in Delphi. I am using vb to call a function in this DLL.

The function asks for PChar of the filename that it will use. I pass a string to the DLL and the DLL brings up a window and says uploading file c to destination when the string i entered was c:\test.txt. It only gets the first character.

Here is the source code i have used
Public Declare Auto Function UploadKill Lib "C:\Program Files\EasyCheck\EasySyncLib.dll" Alias "UploadKillFile" (ByVal Filename As String, ByVal userid As String, ByVal pword As String, ByVal status As String, ByVal maxlength As Integer) As String

and then

dim str as String = "c:\test.txt"
UploadKill(str, "", "", "", 255)

and yes i have tried byRef filename as string

thanks
Avatar of adam_pedley
adam_pedley

ASKER

Solved the problem

Public Declare Auto Function UploadKill Lib "C:\Program Files\EasyCheck\EasySyncLib.dll" Alias "UploadKillFile" (ByVal Filename As String, ByVal userid As String, ByVal pword As String, ByVal status As String, ByVal maxlength As Integer) As String

Changed the auto to ansi and it worked

its always a small change that makes a big difference

First person to say hello on this question gets the 500 points
ASKER CERTIFIED SOLUTION
Avatar of prakash_prk
prakash_prk
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Please deleted the question . post a request to community support .
Don't give points to anyone
put i want to keep this question up, so that if other people have the same problem they can see my solution

i'm on premium services anyway, so i have unlimited points