| 发表于:2007-07-22 19:48:013楼 得分:20 |
该功能我以前写过 用windows的 hook, 贴部分代码给你 bool installmenu(hwnd hthiswnd = null) { g_hthiswnd = hthiswnd; hcallwndret = setwindowshookex(wh_callwndprocret, callwndprocretfunc, hins, 0); hgetmsg = setwindowshookex(wh_getmessage, getmsgprocfunc, hins, 0); return true; } #define dlg_needstyle (ws_caption ¦ ws_sysmenu) callwndprocretfunc() { if(wm_initmenu) //添加菜单 { lstyle = getwindowlong(pcwpret-> hwnd, gwl_style); if((lstyle & dlg_needstyle) == 0 ) //对于某些dlg 是不用加的 ...; insertmenu(pcwpret-> hwnd, bwndtoped); } } getmsgprocfunc() { if(pmsg-> wparam != sc_wndtop) return.... callyouaction(); //加入自己的响应代码 } | | |
|