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

Reply via email to