This code in FireFly works properly and returns the name of the computer:
Dim lpBuffer as ZString * ( MAX_COMPUTERNAME_LENGTH + 1 )
Dim nSize as DWORD = SizeOf( lpBuffer )
If GetComputerName( @lpBuffer, @nSize ) <> 0 Then
In WinFBE - using the same compiler switches as FireFly - I get the following warning:
Quotewarning 3(1): Passing different pointer types, at parameter 1 of GETCOMPUTERNAME()
I must have a compiler switch set incorrectly.
WinFBE has unicode enabled. You need to use a WSTRING or Jose's CWSTR
This is easier. Once you start using CWSTR, you'll use it for everything and it makes unicode applications incredibly easy to code.
DIM AS CWSTR wszComputerName = AfxGetComputerName()
Thanks Paul. Much better - lots to learn!
Anyway, if you want to use ansi for some reason, call explicitily the "A" vesion of the API procedure, i.e. GetComputerNameA instead of GetComputerName. You're getting an error because, as unicode is enabled, using GetComputerName you're calling GetComputerNameW.
I would like to remind one more time that using the ansi versions of the Windows API is innefficiwent because the ansi versions are just wrappers that convert string parameters to unicode and call the unicode versions.