溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

ocx 和 EXE 當(dāng)前路徑運(yùn)行路徑區(qū)別

發(fā)布時(shí)間:2020-07-18 01:25:03 來源:網(wǎng)絡(luò) 閱讀:871 作者:忘記江南 欄目:編程語言

獲取工程運(yùn)行路徑源代碼

string GetProgramDir()     
{      
    char exeFullPath[MAX_PATH]; // Full path   
    string strPath = "";   

    GetModuleFileName(NULL,exeFullPath,MAX_PATH);  
    strPath=(string)exeFullPath;    // Get full path of the file   
    int pos = strPath.find_last_of('\\', strPath.length());   
    return strPath.substr(0, pos);  // Return the directory without the file name   

} 

執(zhí)行結(jié)果:
ocx:會(huì)是IE路徑安裝路徑 ocx 和 EXE 當(dāng)前路徑運(yùn)行路徑區(qū)別

EXE:exe所在文件夾 ocx 和 EXE 當(dāng)前路徑運(yùn)行路徑區(qū)別

獲取工程當(dāng)前路徑源代碼

string GetCurrentDir(const string &path){
    string ls_FileName;
    LPTSTR lpBuffer;
    UINT uSize;
    HANDLE hHeap;
    uSize=(GetCurrentDirectory(0,NULL))*sizeof(TCHAR);
    hHeap=GetProcessHeap();
    lpBuffer=(LPSTR)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,uSize);
    GetCurrentDirectory(uSize,lpBuffer);
        ls_FileName = (string) lpBuffer;
    ls_FileName.append(path);
    return ls_FileName;
}

執(zhí)行結(jié)果:
ocx:會(huì)是用戶桌面 ocx 和 EXE 當(dāng)前路徑運(yùn)行路徑區(qū)別

EXE:運(yùn)行該exe工程的文件夾路徑 ocx 和 EXE 當(dāng)前路徑運(yùn)行路徑區(qū)別

debug:ocx 和 EXE 當(dāng)前路徑運(yùn)行路徑區(qū)別(工程名AAA)

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI