我在在EVC下调用GetWindowsDirectory()函数为什么为什么会产生如下两个错误:
G:\VCproject\Test00\Test00Dlg.cpp(67) : error C2039: 'GetCurrentDirectory' : is not a member of '`global namespace''
G:\VCproject\Test00\Test00Dlg.cpp(67) : error C2065: 'GetCurrentDirectory' : undeclared identifier
我的调用方式是:::GetWindowsDirectory(lpszWinPath, MAX_PATH);
报错的是GetCurrentDirectory()函数,而非GetWindowsDirectory.
WINCE下面没有GetCurrentDirectory()函数。需要相同功能,可以使用GetModuleFileName()来间接实现。
代码呢?贴上来看看!
error C2039: 'GetCurrentDirectory' : is not a member of '`global namespace''
成员指向错了吧!
GetCurrentDirectory(),CE下压根就没有当前目录这个概念,所以这个函数肯定是不支持的。
我没有查帮助,LZ自己查一下吧。
呵呵,月经贴了。
WIN CE不支持GetCurrentDirectory,
如果要获取当前路径信息,只能通过GetModuleFileName来获取。
This function gets a module file name.
WINAPI DWORD GetModuleFileName(
HMODULE hModule,
LPWSTR lpFilename,
DWORD nSize
);
Parameters
hModule
[in] Handle to the module whose executable file name is being requested.
If this parameter is NULL, GetModuleFileName returns the path for the file used to create the calling process.
lpFilename
[out] Pointer to a buffer that is filled in with the path and file name of the module.
nSize
[in] Specifies the length, in characters, of the lpFilename buffer.
If the length of the path and file name exceeds this limit, the string is truncated.
Return Values
The length, in characters, of the string copied to the buffer indicates success.
Zero indicates failure.
To get extended error information, call GetLastError.