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


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

A:


TCHAR szDirectory[MAX_PATH] = "";

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

<br>