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 / Return value (string) from dll

Author
Message
Essence
21
Years of Service
User Offline
Joined: 12th Oct 2002
Location: The Netherlands
Posted: 8th Dec 2004 05:06
Is it possible to return a string instead of a integer ?
--------
Example:

Load dll "user32.dll",1
a$ = call dll 1,"GetVersion"
print a$

--------

How should i do this?
empty
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 8th Dec 2004 22:55 Edited at: 8th Dec 2004 22:55
Yes, it is possible to get a string from a DLL function- if that function actually returns a string... however, the GetVersion function doesn't return a string but a DWORD.

Play Nice! Play Basic!
Version 1.02 available now!
wmf
19
Years of Service
User Offline
Joined: 6th Nov 2004
Location:
Posted: 9th Dec 2004 00:55
the getversion() doesn't exist in user32.dll but it does in kernel32.dll. just use str$(dword) to print a string.
empty
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 9th Dec 2004 01:19
Indeed, but that's not exactly returning strings from a DLL, is it?

Play Nice! Play Basic!
Version 1.02 available now!
Essence
21
Years of Service
User Offline
Joined: 12th Oct 2002
Location: The Netherlands
Posted: 9th Dec 2004 01:42
That GetVersion() thing is just for example. I already knew that it wasnt in user32.

Can you give me a example with that DWORD thing? I have never worked with dword bevore

like this you mean?
----

load dll "kernel32.dll",1
global ret as dword

ret = call dll 1,"GetVersion"
r$=str$(ret)
print ret
----

should this work?
i cant test it now cuz im not at home.

thanks though for your support
wmf
19
Years of Service
User Offline
Joined: 6th Nov 2004
Location:
Posted: 9th Dec 2004 03:58


on my pc this prints;

a = 170393861
hex$(a) = A280105 (0A 28 01 05)

using the hex string this is what you do:

if the high bit in the high byte is 0 it's NT
the low byte (05) is major version 5
the next byte (01) is minor version 1
the two highest bytes (0A 28) = Build 2600 (- the highest bit if it is > 1)

all together - Windows NT 5.1 (Build 2600)
I don't know of any easier way. Maybe empty does.
wmf
19
Years of Service
User Offline
Joined: 6th Nov 2004
Location:
Posted: 9th Dec 2004 04:02
no edit option so here is a correction

the two highest bytes (0A 28) = Build 2600 (- the highest bit if it is > 0)
empty
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 9th Dec 2004 07:27
Quote: "should this work?
i cant test it now cuz im not at home."

Yes it will work but in that case "Print ret" and "Print r$" will print the same number.
What exactly are you trying to achieve?

Play Nice! Play Basic!
Version 1.02 available now!

Login to post a reply

Server time is: 2024-04-27 03:46:31
Your offset time is: 2024-04-27 03:46:31