| View previous topic :: View next topic |
| Author |
Message |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Fri Aug 29, 2003 11:44 pm Post subject: Am I coding this right? |
|
|
I don't think I'm doing this right. Or is there more to this than what
I have?
I'm trying to use the GetComputerName API.
| Code: | %S = 255
loadlib kernel32.dll
%A = @lib(kernel32,GetComputerNameA,BOOL:,@addr("%S"),@addr("%S"))
freelib kernel32.dll
info %A |
And, while trying this and launching the code via the F9 key, I keep
getting this line number, where there's only 4 or 5 lines of code I
wrote :
| Quote: | ---------------------------
Visual DialogScript 5
---------------------------
Error: Unhandled exception ""
at line: 2292585
in file: Untitled.dsc
---------------------------
OK
--------------------------- |
_________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Sat Aug 30, 2003 1:20 am Post subject: |
|
|
FF I think you didn't read the documentation properly.
| Quote: | The GetComputerName function retrieves the computer name of the current system. This name is established at system startup, when it is initialized from the registry.
BOOL GetComputerName(
LPTSTR lpBuffer, // address of name buffer
LPDWORD nSize // address of size of name buffer
);
Parameters
lpBuffer
Points to a buffer to receive the null-terminated character string containing the computer name.
nSize
Points to a variable that specifies the maximum size, in characters, of the buffer. This value should be large enough to contain MAX_COMPUTERNAME_LENGTH + 1 characters. |
____________________________________________________________________
| Code: | %S = @FILL(255)
%L = @BINARY(DWORD,@LEN(%S))
loadlib kernel32.dll
%A = @lib(kernel32,GetComputerNameA,BOOL:,@addr("%S"),@addr("%L"))
freelib kernel32.dll
info @ADJUST(%S) |
I think this *should* work. If not change BOOL: to INT: -looks stupid but sometimes does work
But I agree that @lib() is having lot of teething problems and much is to be done about error handling -
For it sometimes :
Gives error code when there is none.(missing wend,invalid list operation, invalid style and some french error messages which I can't decipher etc)
Doesnot pass the file/folder path parameter to the dll correctly.
Adds the last bracket ")" in the return value for no reason - command works without the closing bracket - weird ?
BOOL: returns empty value but mostly dll still works. If not then onehas to use INT:, - Documentation says BOOL: type of return value and this works in VB too.
In many instances I thought it was the dll at fault and threw away these freeware dlls but when I encountered these problems with system dll's - I couldn't blame them anymore !. _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sat Aug 30, 2003 1:23 pm Post subject: |
|
|
I was totally lost as to what I was doing. Thanks for the help CodeScript!
Now I think I understand better and I'm going to try using the
GetUserName API
Thanks again  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
|
|
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 You can attach files in this forum You can download files in this forum
|
|