Майкрософт Офис, начиная с версии 8.0 (97) использует новый API с теми же фильтрами.
HRESULT Load(LPCTSTR szFile) {
HMODULE hModule = g_pMapExtToFilter->LoadFilter(szFile);
if (NULL == hModule) return E_FAIL;
struct NameStruct {
DWORD dwHead[2];
char szName[MAX_PATH];
DWORD dwTail[2];
};
typedef DWORD (__stdcall *GetFilterInfo_t)
(DWORD dwVersion, DWORD dwReserved, HGLOBAL *phFilterData, DWORD dwReserved2);
typedef DWORD (__stdcall *SetFilterPref_t)
(HGLOBAL hFilterData, LPCSTR szOption, LPCSTR szValue, DWORD dwReserved2, DWORD dwReserved1);
typedef DWORD (__stdcall *ImportGr_t)
(DWORD dwReserved, NameStruct *pFile, ImgInfo *pInfo, HGLOBAL hFilterData);
GetFilterInfo_t pGetFilterInfo = (GetFilterInfo_t)::GetProcAddress(hModule, "GetFilterInfo");
SetFilterPref_t pSetFilterPref = (SetFilterPref_t)::GetProcAddress(hModule, "SetFilterPref");
ImportGr_t pImportGr = (ImportGr_t)::GetProcAddress(hModule, "ImportGr");
if (NULL == pImportGr) pImportGr = (ImportGr_t)::GetProcAddress(hModule, "ImportGR");
if (pImportGr) {
NameStruct name = {0};
HGLOBAL hFilterData = NULL;
if (pGetFilterInfo) {
DWORD dwVer = pGetFilterInfo(2, 0, &hFilterData, 0x00170000);
ATLASSERT(2 == dwVer);
if (2 != dwVer) {
::FreeLibrary(hModule);
return E_UNEXPECTED;
}
}