Solved

Passing PChar to DLL

Posted on 2004-09-02
4
355 Views
Last Modified: 2006-11-17
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
0
Comment
Question by:adam_pedley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 4

Author Comment

by:adam_pedley
ID: 11961603
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
0
 
LVL 10

Accepted Solution

by:
prakash_prk earned 500 total points
ID: 11961652
hello
0
 
LVL 10

Expert Comment

by:prakash_prk
ID: 11961653
Please deleted the question . post a request to community support .
Don't give points to anyone
0
 
LVL 4

Author Comment

by:adam_pedley
ID: 11961669
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
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question