Looking for a little help with the win32 headers
Jean pierre via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Mar 25 22:27:27 PDT 2015
On Thursday, 26 March 2015 at 04:52:23 UTC, Belly wrote:
> Hello, just installed D today. I have this code:
>
> import std.stdio;
> import win32.windef;
> import win32.winbase;
>
> void main()
> {
> LPSTR lpBuffer;
> PDWORD lpnSize;
> int result = GetComputerNameA(lpBuffer, lpnSize);
>
> writeln(result);
> }
>
> It passes zeroes to the API, I'm stuck and can't find a
> suitable sample in the win32 repository here:
> https://github.com/AndrejMitrovic/DWinProgramming
---
import std.stdio;
import core.sys.windows.windows;
extern(Windows) export
bool GetComputerNameA(LPTSTR lpBuffer, LPDWORD lpnSize);
void main(string[] args)
{
uint len = 1024;
char[] result;
result.length = len;
GetComputerNameA(result.ptr, &len);
result.length = len;
writeln(result);
}
---
tested win32
More information about the Digitalmars-d-learn
mailing list