Using
LPTSTR strDLLPath1 = new TCHAR[_MAX_PATH];
::GetModuleFileName((HINSTANCE)&__ImageBase, strDLLPath1, _MAX_PATH);
I get path to my DLL which it correctly prints.
D:\Test\work\EasyDLL\Debug\EasyDLL.dll
Now I just need the "D:\Test\work\EasyDLL\Debug\".
Given my experience using VC++ can you guide me in best way to do that – any string replace, conversion etc.
Look at shell patch handling functions, and more precisely at PathRemoveFileSpec, which does exactly what you want.
You will need to link with shlwapi.lib.