您目前已離線,請等候您的網際網路重新連線

如何在 Microsoft Outlook 中找出 Mapisvc.inf 檔案的正確路徑

Office 2003 支援已結束

Microsoft 於 2014 年 4 月 8 日結束對 Office 2003 的支援。此變更已影響您的軟體更新和安全性選項。 瞭解這對您的意義為何且如何持續受保護。

結論
Microsoft Outlook 會顯露 Mapistub.dll 檔案中的 FGetComponentPath 函數,以協助您尋找 Mapisvc.inf 檔案的路徑。本文將告訴您,如何利用<其他相關資訊>一節中的程式碼範例,尋找 Mapisvc.Inf 檔案的路徑。

在 Microsoft Outlook 2000 之前的版本中,Mapisvc.inf 檔案一直是安裝在系統目錄之下,如同 Win32 API GetSystemDirectory 函數所傳回的內容。
其他相關資訊
注意 下列程式碼範例向後相容於所有舊版 Outlook。無論 Mapisvc.inf 檔案是否存在於系統目錄下,下列程式碼範例都會尋找 Mapisvc.inf 檔案的路徑。
typedef BOOL (STDAPICALLTYPE FGETCOMPONENTPATH)(LPSTR szComponent,LPSTR szQualifier,LPSTR szDllPath,DWORD cchBufferSize,BOOL fInstall);typedef FGETCOMPONENTPATH FAR * LPFGETCOMPONENTPATH;    /////////////////////////////////////////////////////////////////////////////// // Function name    :InitMAPIDir// Description      :For Outlook 2000 compliance.This will get the correct path to the//                  : MAPISVC.INF file.// Return type      :void // Argument         :LPSTR szMAPIDir - Buffer to hold the path to the MAPISVC file.//                  : ULONG cchINIFileName - size of szMAPIDirvoid InitMAPIDir(LPSTR szINIFileName, ULONG cchINIFileName){UINT uiRet = 0;CHAR szSystemDir[MAX_PATH+1] = {0};// Get the system directory path// (mapistub.dll and mapi32.dll reside here)uiRet = GetSystemDirectoryA(szSystemDir, MAX_PATH);if(uiRet > 0)    {HRESULT hRes = S_OK;CHAR szDLLPath[MAX_PATH+1] = {0};hRes = StringCchPrintfA(szDLLPath, MAX_PATH+1, "%s\\%s", szSystemDir, "mapistub.dll");if(SUCCEEDED(hRes))        {LPFGETCOMPONENTPATH pfnFGetComponentPath = NULL;HMODULE hmodStub = 0;HMODULE hmodMapi32 = 0;// Load mapistub.dllhmodStub = LoadLibraryA(szDLLPath);if(hmodStub)            {   // Get the address of FGetComponentPath from the mapistubpfnFGetComponentPath = (LPFGETCOMPONENTPATH)GetProcAddress(hmodStub, "FGetComponentPath");            }// If we didn't get the address of FGetComponentPath// try mapi32.dllif(!pfnFGetComponentPath)            {hRes = StringCchPrintfA(szDLLPath, MAX_PATH+1, "%s\\%s", szSystemDir, "mapi32.dll");if(SUCCEEDED(hRes))                {// Load mapi32.dllhmodMapi32 = LoadLibraryA(szDLLPath);if(hmodMapi32)                    {// Get the address of FGetComponentPath from mapi32pfnFGetComponentPath = (LPFGETCOMPONENTPATH)GetProcAddress(hmodMapi32, "FGetComponentPath");                    }                }            }BOOL bRet = FALSE;if(pfnFGetComponentPath)            {// Now that we have the address of FGetComponentPath// Let's call it with the GUID for mapisvc.infbRet = pfnFGetComponentPath("{473FF9A0-D659-11D1-A4B2-006008AF820E}",NULL, szINIFileName, cchINIFileName, TRUE);             }// If FGetComponentPath returns FALSE or if// it returned nothing, or if we never found an// address of FGetComponentPath, then// just default to the system directoryif(!bRet || szINIFileName[0] == '\0')            {hRes = StringCchPrintfA(szINIFileName, cchINIFileName,"%s\\%s", szSystemDir, "mapisvc.inf");            }if(hmodMapi32)FreeLibrary(hmodMapi32);if(hmodStub)FreeLibrary(hmodStub);        }    }}
Outlook 2000 OL2K OL2000 Outlook2000 MAPISVC.INF IMsgServiceAdmin kbGrpMsg kbMsg kbMAPI kbMAPI100 kbOutlook97 kbOutlook98
內容

文章識別碼:229700 - 最後檢閱時間:12/14/2005 09:02:00 - 修訂: 5.2

Microsoft Office Outlook 2003, Microsoft Outlook 2002 Standard Edition, Microsoft Outlook 2000 Standard Edition, Microsoft Messaging Application Programming Interface

  • kbhowto kbmsg kbfaq KB229700
意見反應
">