70,020
社区成员




shared_ptr<wstring> getAppPath()
{
wchar_t path[MAX_PATH];
GetModuleFileName(NULL, path, _countof(path));
PathRemoveFileSpec(path);
return shared_ptr<wstring>(new wstring(path));
}
#include "windows.h"
#include "tchar.h"
....
TCHAR szAppDir[MAX_PATH];
GetModuleFileName(GetModuleHandle(NULL), szAppDir, sizeof(szAppDir));
TCHAR* t = _tcsrchr(szAppDir, TEXT('\\'));
*t = 0;
SetCurrentDirectory(szAppDir);
....