你目前正处于脱机状态,正在等待 Internet 重新连接

如何在 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 文件的路径,无论该文件是否存在于系统目录下。
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.dll            hmodStub = LoadLibraryA(szDLLPath);            if(hmodStub)            {                   // Get the address of FGetComponentPath from the mapistub                pfnFGetComponentPath = (LPFGETCOMPONENTPATH)GetProcAddress(                    hmodStub, "FGetComponentPath");            }            // If we didn't get the address of FGetComponentPath            // try mapi32.dll            if(!pfnFGetComponentPath)            {                hRes = StringCchPrintfA(szDLLPath, MAX_PATH+1, "%s\\%s",                     szSystemDir, "mapi32.dll");                if(SUCCEEDED(hRes))                {                    // Load mapi32.dll                    hmodMapi32 = LoadLibraryA(szDLLPath);                    if(hmodMapi32)                    {                        // Get the address of FGetComponentPath from mapi32                        pfnFGetComponentPath = (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.inf                bRet = 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 directory            if(!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
属性

文章 ID:229700 - 上次审阅时间:12/06/2005 04:31:00 - 修订版本: 5.1

Microsoft Office Outlook 2003, Microsoft Outlook 2002 标准版, Microsoft Outlook 2000 标准版, Microsoft Messaging Application Programming Interface

  • kbhowto kbmsg kbfaq KB229700
反馈
s://c.microsoft.com/ms.js">