SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Return value from Call-ed functions

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Return value from Call-ed functions
Author Message
nick



Joined: 12 Jan 2004
Posts: 3

Post Return value from Call-ed functions Reply with quote

I have a problem reading the return code of DLL functions that returns a "long" (or DWORD).
I have tried all the possible type-specifiers (n,N,l,L,u,U) without success.
Using "n" the result is ever 0, otherwise is 4290772992!

What is the right type-specifier?

You can try this behaviour using this script (the return code should be the number of written characters):

//DWORD GetCurrentDirectory(
// DWORD nBufferLength,
// LPTSTR lpBuffer
//);

Dim buffer, string
Dim result, number

Space 128, buffer
Call "kernel32.dll", "GetCurrentDirectory", "nSn", True, 128, buffer, result

ConcatEx "result=", result, ", buffer=", buffer, buffer
MessageBox buffer

Wed Jan 14, 2004 6:02 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7969

Post Re: Return value from Call-ed functions Reply with quote

I tried your code and I got 2200 as a return code which is probably wrong but the buffer value was populated correctly with the name of the current directory.

: I have a problem reading the return code of DLL functions that returns a
: "long" (or DWORD).
: I have tried all the possible type-specifiers (n,N,l,L,u,U) without success.
: Using "n" the result is ever 0, otherwise is 4290772992!

: What is the right type-specifier?

: You can try this behaviour using this script (the return code should be the
: number of written characters): //DWORD GetCurrentDirectory(
: // DWORD nBufferLength,
: // LPTSTR lpBuffer
: //);

: Dim buffer, string
: Dim result, number

: Space 128, buffer
: Call "kernel32.dll", "GetCurrentDirectory",
: "nSn", True, 128, buffer, result

: ConcatEx "result=", result, ", buffer=", buffer, buffer
: MessageBox buffer

Wed Jan 14, 2004 9:34 am View user's profile Send private message
nick



Joined: 12 Jan 2004
Posts: 3

Post Re: Return value from Call-ed functions Reply with quote

: I tried your code and I got 2200 as a return code which is probably wrong but
: the buffer value was populated correctly with the name of the current
: directory.

Is there a way to obtain the right value from functions that return a long?
By the way the right format specifier for the return code should be "l" and not "n" ...

Thank you for your help.

Wed Jan 14, 2004 9:51 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7969

Post Re: Return value from Call-ed functions Reply with quote

I don't know why a wrong value is returned in this case. I will contact developers to find out how this should be handled.

: Is there a way to obtain the right value from functions that return a long?
: By the way the right format specifier for the return code should be
: "l" and not "n" ...

: Thank you for your help.

Wed Jan 14, 2004 10:09 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.