_CRTIMP void __cdecl _splitpath (const char *, char *, char *, char *, char *);
_CRTIMP void __cdecl _makepath (char *, const char *, const char *, const char *, const char *);
WINBASEAPI BOOL WINAPI SetCurrentDirectory ( LPCSTR lpPathName );
WINBASEAPI DWORD WINAPI GetModuleFileName ( HMODULE hModule, LPSTR lpFilename, DWORD nSize );
示例:
CString cTemp;
char FileName[MAX_PATH];
::GetModuleFileName(NULL,FileName,MAX_PATH);
char drive[_MAX_DRIVE];
char dir[_MAX_DIR];
_splitpath(FileName,drive,dir,NULL,NULL);
//设置当前目录
_makepath(FileName,drive,dir,NULL,NULL);
SetCurrentDirectory(FileName);
//sprintf(FileName,"SetUp.INI");
_makepath(FileName,drive,dir,"setup",".INI");
阅读(1263) | 评论(0) | 转发(0) |