Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/156.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 我的代码没有';不能在Windows XP上工作_C++_Windows_Winapi - Fatal编程技术网

C++ 我的代码没有';不能在Windows XP上工作

C++ 我的代码没有';不能在Windows XP上工作,c++,windows,winapi,C++,Windows,Winapi,由于Win-7拖放实现已经改变,为了使其工作,我需要使用启用一些东西 有一个问题ChangeWindowMessageFilter自Vista以来一直有效,但我也需要XP的解决方案。好吧,您应该尝试动态调用它,因为您需要和 样本使用 if (/*IsVista()*/) { typedef BOOL (WINAPI *ChangeMessageFilter)(UINT message, DWORD dwFlag); #define MSGFLT_ADD 1 #defin

由于Win-7拖放实现已经改变,为了使其工作,我需要使用启用一些东西


有一个问题
ChangeWindowMessageFilter
自Vista以来一直有效,但我也需要XP的解决方案。

好吧,您应该尝试动态调用它,因为您需要和


样本使用

if (/*IsVista()*/)
{
    typedef BOOL (WINAPI *ChangeMessageFilter)(UINT message, DWORD dwFlag);
    #define MSGFLT_ADD 1
    #define MSGFLT_REMOVE 2
    BOOL res = FALSE;
    HMODULE user32 = LoadLibrary(L"User32.dll");
    if (user32 != NULL)
    {
        ChangeMessageFilter filter = (ChangeMessageFilter)::GetProcAddress(user32, "ChangeWindowMessageFilter");
        if (filter != NULL)
        {
            res = filter(/*your value*/, MSGFLT_ADD);
        }
        ::FreeLibrary(user32);
    }
}

另一件事,您应该更好地使用,因为它只允许一个窗口接收消息,而不是所有项目。

(Vista+)将更改作为一个整体应用于整个过程。(Win7+)将更改应用于特定窗口。