Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / Delphi - String Manipulation DLL Help

Author
Message
The Lone Programmer
21
Years of Service
User Offline
Joined: 29th Jan 2003
Location: California, USA
Posted: 22nd Jun 2005 10:43
Ok,
I successfully created a DLL which gets half the job done. I feel so proud.

Anyways this is what the code looks like.




This is what my Dark Basic Pro code to execute looks like



Anyways as you can see its a ReplaceString DLL. My problem is that in DBP it will replace the first occurrance of the word to be found and then just stop.
So that DBP code I supplied will have an output like this:

When it should look like this:


Why does it just stop after the first occurrance? Why doesnt it change what it needs to and continue to print out the rest of the string? Is it the way I converted my String into a PChar? My StringTable is correct but if for some strange reason you need to see it please tell me.

I would appreciate the help guys.

Thanks,
The Lone Programmer

Mess With The Best, Die Like The Rest.
empty
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 22nd Jun 2005 18:19 Edited at: 22nd Jun 2005 18:20
Ooops, somehow the link disappeared in the other thread....
Anyway, two things:
1) You need to pass DBpro strings as PChar to you Delphi function and not as String.
2) Returning strings from a TPC works different as you can see here:
Link

Download my example TPC (4th post). It explains how to handle strings.


Play Nice! Play Basic! Version 1.073
The Lone Programmer
21
Years of Service
User Offline
Joined: 29th Jan 2003
Location: California, USA
Posted: 23rd Jun 2005 01:36
I downloaded your example before I posted this.

I read the comments but did not understand what was happening.

Why does my code only get half way? It wants to work, but stops after it does what it needs to do.

Maybe you can log into AIM again some time and help me real fast? I would greatly appreciate it.


Thanks,
The Lone Programmer

Mess With The Best, Die Like The Rest.
The Lone Programmer
21
Years of Service
User Offline
Joined: 29th Jan 2003
Location: California, USA
Posted: 23rd Jun 2005 01:48
OMFG I got it....

Woot I feel so accomplished now. I re-looked over your code and I saw that instead of inputing string values you just converted the PChar values into string values then converted backwords when finished.

It worked. Thanks for the help man.

BTW: Some of the commands in your code didn't work for me. Maybe I am stupid or something but they didn't exist for me. Don't know what happened there.

Well thanks again,
The Lone Programmer

Mess With The Best, Die Like The Rest.

Login to post a reply

Server time is: 2024-03-28 13:03:30
Your offset time is: 2024-03-28 13:03:30