原文链接:http://blog.csdn.net/ningbinzhang/article/details/39956801
相关文章:http://blog.chinaunix.net/uid-30092150-id-4738158.html
-
#pragma once
-
-
-
#ifndef WM_COPYGLOBALDATA
-
#define WM_COPYGLOBALDATA 0x0049
-
#endif
-
-
-
typedef WINUSERAPI BOOL WINAPI CHANGEWINDOWMESSAGEFILTER(UINT message, DWORD dwFlag);
-
-
-
-
void DropFileFix()
-
{
-
HINSTANCE hDllInst = LoadLibrary(_T("user32.dll"));
-
if (hDllInst)
-
{
-
CHANGEWINDOWMESSAGEFILTER *pAddMessageFilterFunc = (CHANGEWINDOWMESSAGEFILTER *)GetProcAddress(hDllInst, "ChangeWindowMessageFilter");
-
if (pAddMessageFilterFunc)
-
{
-
pAddMessageFilterFunc(WM_DROPFILES, MSGFLT_ADD); //MSGFLT_ADD=1
-
pAddMessageFilterFunc(WM_COPYDATA, MSGFLT_ADD);
-
pAddMessageFilterFunc(0x0049, MSGFLT_ADD);
-
}
-
FreeLibrary(hDllInst);
-
}
-
}
在程序入口或对话框初始化函数中调用DropFileFix() 即可解决vista和win7中使用管理员权限接收不到WM_DROPFILES(OnDropFiles())消息的问题。
阅读(1407) | 评论(0) | 转发(0) |