UINT GetWindowsDirectory(
LPTSTR lpBuffer, // address of buffer for Windows directory
UINT uSize // size of directory buffer
);
Return Values
If the function succeeds, the return value is the length, in characters, of the string copied to the buffer, not including the terminating null character.
If the length is greater than the size of the buffer, the return value is the size of the buffer required to hold the path.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Der korrekte Aufruf muss so gestaltet sein, dass die Variablen vor dem Aufruf der API-Befehle mit einer ausreichenden Grösse (z. B. 255) initialisiert werden müssen!
Siehe Beispiel auf http://www.basicworld.com/vbplus/tt130297.htm
Servus
Roland
[Bei dieser Antwort wurde das Vollzitat nachträglich automatisiert entfernt]