獲取模組檔案路徑名

2021-05-27 01:26:38 字數 830 閱讀 6336

// 獲取模組檔案路徑名

static bool getmodulepathname(cstdstring& strmodulepathname)

::zeromemory(szdrive, sizeof(szdrive));

::zeromemory(szdir, sizeof(szdir));

::zeromemory(szfilename, sizeof(szfilename));

::zeromemory(szext, sizeof(szext));

::zeromemory(sznewfile, sizeof(sznewfile));

::zeromemory(szfiledata, sizeof(szfiledata));

// split the path

::_tsplitpath(szmodulename, szdrive, szdir, szfilename, szext);

strmodulepathname.format("%s%s", szdrive, szdir);

return true;

}bool apientry dllmain(_in_ void * _hdllhandle, _in_ unsigned _reason, _in_opt_ void * _reserved)

return true ;

}當然,對於hmodule,dllmain它也傳遞過來的. 

但mfc的dll的話,因為自己並不寫dllmain,所以得考慮getmodulehandle/getmodulehandleex 

在mfc的dll中也可以用afxgetinstancehandle  

Python 獲取路徑名和檔名

os.path.dirname 和os.path.abspath 的區別 dirname是獲取的檔案所在目錄的路徑 abspath是獲取的檔案的絕對路徑 但是,當dirname括號內是相對路徑的時候,他返回是空,什麼都沒有 而如果abspath執行的話,如果檔案在當前目錄下有,他就返回,如果沒有,他...

檔案過濾驅動 獲取全路徑名

第一部分 取全路徑 以下是獲取全路徑的所有函式 string操作參見字串操作的乙個庫unicode.lib record add by lwf 07 07 25 purpose get symbolic target unicode string pvoid spygetsymbolicunistr...

Python分解路徑名

python分解路徑名的實際操作步驟的介紹,其中我們會設定很多的假設,以及一些相關 的介紹,以方便你在學習的過程中更好的掌握python分解路徑名的實際操作步驟。python分解路徑名假設我們使用變數fname來存放乙個包含完整路徑的檔名,例如 usr home hpl scripting pyth...