GetModuleFileName (NULL, pathBuffer, sizeof (pathBuffer)); // GetModuleFileName returns the length of the path as a DWORD, and the path string to the buffer provided.