| 9 | using namespace std; |
| 10 | |
| 11 | wchar_t* FindRootAppDir() |
| 12 | { |
| 13 | wchar_t* ourDirectory = new wchar_t[MAX_PATH]; |
| 14 | |
| 15 | GetModuleFileName(GetModuleHandle(NULL), ourDirectory, MAX_PATH); |
| 16 | wchar_t* lastSlash = wcsrchr(ourDirectory, L'\\'); |
| 17 | if (!lastSlash) { |
| 18 | delete[] ourDirectory; |
| 19 | return NULL; |
| 20 | } |
| 21 | |
| 22 | // Null-terminate the string at the slash so now it's a directory |
| 23 | *lastSlash = 0x0; |
| 24 | return ourDirectory; |
| 25 | } |
| 26 | |
| 27 | wchar_t* FindOwnExecutableName() |
| 28 | { |