首页 > 代码库 > 解决Win7下UAC开启时无法响应WM_DROPFILES消息

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

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消息