我正在使用以下代码动态链接到LoadIconWithScaleDown API,以便我的代码能够在 Windows XP 上运行:
HRESULT (WINAPI *pfnLoadIconWithScaleDown)(HINSTANCE, PCWSTR, int, int, HICON *);
HMODULE hComCtrl32 = LoadLibrary(_T("Comctl32.dll"));
if(hComCtrl32)
{
(FARPROC&)pfnLoadIconWithScaleDown = GetProcAddress(hComCtrl32, "LoadIconWithScaleDownW");
}
我在 Windows 7 上尝试此代码,但“pfnLoadIconWithScaleDown”始终为 NULL。为什么?