Visual c++ 如何使用visualc++;
我有一个应用程序,相对于应用程序所在的位置,它从“images\”文件夹加载很少的图像文件。谁能告诉我如何在VisualC++中找到位置。一个快速的谷歌搜索显示,没有直接的方法。有人能帮我解决这个问题吗 谢谢 DM使用GetModuleFilename()获取应用程序的完整路径并切掉可执行文件名:Visual c++ 如何使用visualc++;,visual-c++,windows-mobile,Visual C++,Windows Mobile,我有一个应用程序,相对于应用程序所在的位置,它从“images\”文件夹加载很少的图像文件。谁能告诉我如何在VisualC++中找到位置。一个快速的谷歌搜索显示,没有直接的方法。有人能帮我解决这个问题吗 谢谢 DM使用GetModuleFilename()获取应用程序的完整路径并切掉可执行文件名: wchar_t appPath[ MAX_PATH ]; memset( appPath, 0, MAX_PATH * sizeof( wchar_t ) ); wchar_
wchar_t appPath[ MAX_PATH ];
memset( appPath, 0, MAX_PATH * sizeof( wchar_t ) );
wchar_t modulePath[MAX_PATH];
if ( GetModuleFileName( NULL, modulePath, MAX_PATH ) > 0 )
{
wchar_t *lastBackSlash = wcsrchr( modulePath, '\\' );
if ( lastBackSlash )
{
memcpy( appPath, modulePath, ( lastBackSlash - modulePath ) * sizeof( wchar_t ) );
}
}