Click to See Complete Forum and Search --> : Windows SDK Application: How to get the windows directory?


Andreas Masur
September 20th, 2003, 04:19 AM
Q: How to get the windows directory?

A:


TCHAR szDirectory[MAX_PATH] = "";

UINT Bytes = ::GetWindowsDirectory(szDirectory, sizeof(szDirectory));
if(!Bytes)
// Error -> call '::GetLastError()'
else if(Bytes > sizeof(szDirectory))
// Buffer too small
else
// Success

<br>