【问题标题】:"cannot find import" error when running program in Windows XP that uses ChangeWindowMessageFilter在使用 ChangeWindowMessageFilter 的 Windows XP 中运行程序时出现“找不到导入”错误
【发布时间】:2011-07-24 08:26:20
【问题描述】:

我有一个程序在 Windows 7/Vista 上运行良好,但在 Windows XP 中执行时出现错误。它曾经运行,但我添加了一个功能,在 Windows 7 上,需要函数 ChangeWindowMessageFilter。 Windows XP 给出的错误是

“找不到导入;DLL 可能丢失、损坏或版本错误文件“USER32.dll”,函数“ChangeWindowMessageFilter”(错误 0)”

奇怪的部分是我有一个被 if 语句包围的函数,它确保操作系统版本是 Vista 或更高,因此它甚至没有被调用。然而有一个错误。这是怎么回事?

这里发生了什么?

【问题讨论】:

    标签: winapi windows-xp operating-system


    【解决方案1】:
    【解决方案2】:

    听起来你是在做静态链接而不是动态链接。

    试试这个:

    在头文件中:

    typedef BOOL (WINAPI *PFN_CHANGEWINDOWMESSAGEFILTER) (UINT, DWORD);

    在 C/CPP 文件中:

    PFN_CHANGEWINDOWMESSAGEFILTER pfnChangeWindowMessageFilter = (PFN_CHANGEWINDOWMESSAGEFILTER) GetProcAddress (hModule, "ChangeWindowMessageFilter");

    if (pfnChangeWindowMessageFilter) { /* Do the stuff */ }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-17
      • 1970-01-01
      • 2013-03-08
      相关资源
      最近更新 更多