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 / Weird problem involving returning strings

Author
Message
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 12th Apr 2009 18:46 Edited at: 12th Apr 2009 18:46
Ok, so I'm trying to retrieve the text of a windows GUI control--an edt box to be specific. Here's the function:



Initially the problem was that this function was simply returning a blank string--naturally I thought that I wasn't using GetWindowText() right, so I decided to check what szText contained after the function by calling PrintStringFunction(). And that's when I encountered a strange problem. If I change the string table so that DBP thinks the function is returning a DWORD, then the string is printed, and accurately represents what's in the edit box. It doesn't matter what I return--I can return a string using DBPString, or I can return a number--as long as I tell the string table I'm returning a DWORD szText is printed correctly. However as soon as I change the string table to return a string, szText no longer prints. It doesn't matter what string I return--it can be a blank string or szText--it simply doesn't print. Any ideas what's going on here?

i like orange
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 12th Apr 2009 19:34 Edited at: 12th Apr 2009 19:34
If the function returns a string then its first parameter should be an LPSTR or DWORD (this is not specified in the string table), pass this as the first parameter to DBPString (I assume). This is the address of the old string.

chunks chunks
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: ackworth uk
Posted: 12th Apr 2009 19:54 Edited at: 18th May 2009 17:23
Try this way it works fine for me ...




thanks chunks

nvidia geforce 9500gt + amd athlon 64
windows xp pro.
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 12th Apr 2009 20:00 Edited at: 12th Apr 2009 20:01
Thanks a ton, I got it working.

EDIT:

chunks:

Thanks, I got it working but I'll try out your function anyway just cause it could save me a bit of work.

i like orange
chunks chunks
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: ackworth uk
Posted: 12th Apr 2009 20:53
cool , give credit to diggsey and ianm cose they helped me with it a while back , glad u got it working ..


chunks

nvidia geforce 8600gt + amd athlon 64
windows xp pro.
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 12th Apr 2009 21:24
Will do.

i like orange

Login to post a reply

Server time is: 2024-04-19 23:35:38
Your offset time is: 2024-04-19 23:35:38