Get DLL path at runtime

前端 未结 10 1415
梦谈多话
梦谈多话 2020-11-28 22:31

I want to get a dll\'s directory (or file) path from within its code. (not the program\'s .exe file path)

I\'ve tried a few methods I\'ve found:

10条回答
  •  旧时难觅i
    2020-11-28 23:26

    HMODULE hmod = GetCurrentModule();
    TCHAR szPath[MAX_PATH + 1] = 0;
    DWORD dwLen = GetModuleFileHName(hmod, szPath, MAX_PATH);
    

提交回复
热议问题