[fpc-pascal]Win32 API function not working

James_Wilson at i2.com James_Wilson at i2.com
Thu Jan 24 22:53:29 CET 2002

I'm trying to compile a program using the Win32 API function 
GetComputerName, but when I do I get the message "Error: Can't determine 
which overloaded function to call". The string GetComputerName does not 
exist anywhere in my code, other then this one line where I attempt to 
call that function, so it's not being overloaded by me.  :-)

If I call the function explicitly -- GetComputerName.WINDOWS -- I don't 
get the overload error but I do get these two messages "Error: Wrong 
amount of parameters specified" and "Fatal: Syntax error, ";" expected but 
"(" found". According to ascdef.inc the calling convention is "function 
GetComputerName(lpBuffer:LPSTR; nSize:LPDWORD):WINBOOL;".

The portion of my source code in question looks like this:

  MAX_SIZE = 255;

  NullString : pchar;

GetComputerName.WINDOWS (NullString,MAX_SIZE);

The Win32 API reference looks pretty much the same:

BOOL GetComputerName
    LPTSTR lpBuffer,    // address of name buffer 
    LPDWORD nSize       // address of size of name buffer 

ppc386 -i says this:

Free Pascal Compiler version 1.1
Compiler Date  : 2001/06/19
Compiler Target: i386

It's probably fairly obvious, but I sure can't see it. Can anyone see what 
I'm doing wrong here? TIA...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20020124/e91137f5/attachment.html>

More information about the fpc-pascal mailing list