今天真给这WM_DROPFILES郁闷了下,程序本来运行的好好的,后来改为以管理员身份运行后愣是没反应。没办法,程序必须要有一定的权限才能正常工作,偶菜鸟只能问人找资料了。
在MSDN上翻到了“Understanding and Working in Protected Mode Internet Explorer”,知道了Vista(当然包括Win7)introduced the UIPI which does not allow low right process to send message to the high right processes, 就不让你低权限的给高权限的发消息,~
里面有“Allowing Drag and Drop Operations in your Application”,可是,我按照去做了,往注册表加了那些东西,还是没反应,那个郁闷,囧~
再后来,Google到了CSDN,哈,还是那的答案给我解决了!简单~
加上
ChangeWindowMessageFilter(0x0049, MSGFLT_ADD);
ChangeWindowMessageFilter(WM_DROPFILES, MSGFLT_ADD);
其中#define WM_COPYGLOBALDATA 0x0049,说是DDK里面的头文件有~
之前只加了ChangeWindowMessageFilter(WM_DROPFILES, MSGFLT_ADD);这么一句,不行,还以为被微软忽悠了,囧~
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
#define WM_COPYGLOBALDATA 0x0049 typedef WINUSERAPI BOOL WINAPI CHANGEWINDOWMESSAGEFILTER(UINT message, DWORD dwFlag); void ChangeMessageProi() { HINSTANCE hDllInst = LoadLibrary(_T("user32.dll")); if (hDllInst) { CHANGEWINDOWMESSAGEFILTER *pAddMessageFilterFunc = (CHANGEWINDOWMESSAGEFILTER *)GetProcAddress(hDllInst, "ChangeWindowMessageFilter"); if (pAddMessageFilterFunc) { pAddMessageFilterFunc(WM_DROPFILES, MSGFLT_ADD); pAddMessageFilterFunc(WM_COPYDATA, MSGFLT_ADD); pAddMessageFilterFunc(0x0049, MSGFLT_ADD); } FreeLibrary(hDllInst); } } |
受教了!呵呵!