| 发表于:2007-08-06 21:15:584楼 得分:50 |
我前段时间写了个你自己修改下吧 下面是窗体代码 option explicit private declare function showwindow lib "user32 " (byval hwnd as long, byval ncmdshow as long) as long private declare function setparent lib "user32 " (byval hwndchild as long, byval hwndnewparent as long) as long private declare function findwindow lib "user32 " alias "findwindowa " (byval lpclassname as string, byval lpwindowname as string) as long private declare function movewindow lib "user32 " (byval hwnd as long, byval x as long, byval y as long, byval nwidth as long, byval nheight as long, byval brepaint as long) as long private declare function clienttoscreen lib "user32 " (byval hwnd as long, lppoint as pointapi) as long private declare function findwindowex lib "user32 " alias "findwindowexa " (byval hwnd1 as long, byval hwnd2 as long, byval lpsz1 as string, byval lpsz2 as string) as long private declare function getclientrect lib "user32 " (byval hwnd as long, lprect as rect) as long private declare function messagebox lib "user32 " alias "messageboxa " (byval hwnd as long, byval lptext as string, byval lpcaption as string, byval wtype as long) as long private type pointapi x as long y as long end type private type rect left as long top as long right as long bottom as long end type private sub cmdexit_click() unload me end sub private sub cmdleave_click() dim lngstart as long, lngstartbutton as long, objpoint as pointapi, objrect as rect me.hide lngstart = findwindow( "shell_traywnd ", vbnullstring) setparent lngcmdhwnd, lngstart lngstartbutton = findwindowex(lngstart, 0, "button ", vbnullstring) 'clienttoscreen lngstartbutton, objpoint getclientrect lngstartbutton, objrect movewindow lngcmdhwnd, 0, 0, objrect.right - objrect.left, objrect.bottom - objrect.top, 1 end sub public sub cmdsend_click() ' messagebox me.hwnd, "我能响应事件!! ", "哈哈!! ", vbinformation ' showwindow me.hwnd, 5 ' setparent lngcmdhwnd, me.hwnd ' cmdsend.move 1800, 2880, cmdexit.width, cmdexit.height popupmenu me.mnuopen end sub private sub cmdsend_keydown(keycode as integer, shift as integer) if keycode = 27 then setparent lngcmdhwnd, me.hwnd cmdsend.move 1800, 2880, cmdexit.width, cmdexit.height me.show end if end sub private sub form_load() lngcmdhwnd = me.cmdsend.hwnd hhook = setwindowshookex(wh_mouse_dll, addressof mouseproc, app.hinstance, 0) end sub private sub form_unload(cancel as integer) unhookwindowshookex hhook end sub private sub mnucalc_click() shell "calc ", vbnormalfocus end sub private sub mnunote_click() shell "notepad.exe ", vbnormalfocus end sub | | |
|