{I+=codeWee;}
[C++] WinApi : How to get the current exe program Path
#include <Windows.h>

	TCHAR szFilePath[1024];
	GetModuleFileName(m_hInstance, szFilePath, 1024);
	CString sPath(szFilePath);
	int pos = sPath.ReverseFind('\\');
	if (pos >= 0)
	{
		sPath = sPath.Left(pos+1);    
	}




-----------------------


	TCHAR fullPath[MAX_PATH];
	TCHAR driveLetter[3];
	TCHAR directory[MAX_PATH];
	TCHAR FinalPath[MAX_PATH];
	GetModuleFileName(NULL, fullPath, MAX_PATH);
	_splitpath(fullPath, driveLetter, directory, NULL, NULL);
	sprintf(FinalPath, "%s%s",driveLetter, directory);
HTML | PHP | C++ | DirectX11 | Javascript | C# | HTML5 | ASP | SQL | General | CSS | Oculus Rift | Unity3d | Virtools SDK | Tip | NSIS | PowerShell | node.js | Web API | RTSP | All
Copyright© 2016 CodeWee.com All rights reserved.