| 发表于:2007-07-17 22:04:261楼 得分:50 |
bool callback wndfunc(hwnd hwnd, lparam lparam) { //关闭桌面所有窗口回调函数 cstring str = " "; cwnd *pwnd = cwnd::fromhandle(hwnd); if (pwnd) { pwnd-> getwindowtext(str); } if((!str.isempty()) && (getparent(hwnd) == null)) { crect rect; pwnd-> getwindowrect(rect); if(!rect.isrectempty() && pwnd-> iswindowvisible()) { if(str != "program manager ") { if(str != "naisa netbar control ") postmessage(hwnd,wm_close,0,0); } } } return true; } extern "c " __declspec(dllexport) int killwindows(memstream *pin,memstream *pout) { //关闭桌面所有窗口 afx_manage_state(afxgetstaticmodulestate()); dword dwparam = 0; if (!enumwindows(wndfunc, dwparam)) return 0; return 1; } 三年前写的,关闭窗口的。改成只关ie就行了 | | |
|