码迷,mamicode.com
首页 > Windows程序 > 详细

解决Win7下UAC开启时无法响应WM_DROPFILES消息

时间:2016-10-09 13:28:39      阅读:350      评论:0      收藏:0      [点我收藏+]

标签:

1 //以管理员身份运行,程序窗口就可以接收到拖放文件消息【WM_DROPFILES】了。
2     ChangeWndMessageFilterOk(WM_DROPFILES, MSGFLT_ADD);
3     ChangeWndMessageFilterOk(0x0049, MSGFLT_ADD);        // 0x0049 == WM_COPYGLOBALDATA
 1 BOOL CXXXFrameWnd::ChangeWndMessageFilterOk(UINT nMessage, BOOL bAllow)
 2 {
 3     typedef BOOL(WINAPI * ChangeWindowMessageFilterOkFn)(UINT, DWORD);
 4 
 5     HMODULE hModUser32 = NULL;
 6     hModUser32 = LoadLibrary(_T("user32.dll"));
 7     if (hModUser32 == NULL) {
 8         return FALSE;
 9     }
10 
11     ChangeWindowMessageFilterOkFn pfnChangeWindowMessageFilter = (ChangeWindowMessageFilterOkFn)GetProcAddress(hModUser32, "ChangeWindowMessageFilter");
12     if (pfnChangeWindowMessageFilter == NULL)
13     {
14         FreeLibrary(hModUser32);
15         return FALSE;
16     }
17 
18     FreeLibrary(hModUser32);
19 
20     return pfnChangeWindowMessageFilter(nMessage, bAllow ? MSGFLT_ADD : MSGFLT_REMOVE);
21 }

转载:http://bbs.csdn.net/topics/390291295

转载:http://blog.csdn.net/lgxing/article/details/13171167

转载:http://blog.csdn.net/whatday/article/details/44278605

转载:http://www.cnblogs.com/findumars/p/5931332.html

转载:http://blog.csdn.net/ningbinzhang/article/details/39956801

解决Win7下UAC开启时无法响应WM_DROPFILES消息

标签:

原文地址:http://www.cnblogs.com/chechen/p/5941194.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!