| 发表于:2007-04-25 18:53:3818楼 得分:75 |
public class form1 public const wm_hotkey = &h312 public const mod_alt = &h1 public const mod_control = &h2 public const mod_shift = &h4 public const gwl_wndproc = (-4) public declare auto function registerhotkey lib "user32.dll " alias _ "registerhotkey " (byval hwnd as intptr, byval id as integer, byval fsmodifiers as integer, byval vk as integer) as boolean public declare auto function unregisterhotkey lib "user32.dll " alias _ "unregisterhotkey " (byval hwnd as intptr, byval id as integer) as boolean private sub form1_load(byval sender as system.object, byval e as system.eventargs) handles mybase.load registerhotkey(handle, 0, mod_control, asc( "t ")) end sub private sub form1_formclosed(byval sender as system.object, byval e as system.windows.forms.formclosedeventargs) handles mybase.formclosed unregisterhotkey(handle, 0) end sub protected overrides sub wndproc(byref m as message) if m.msg = wm_hotkey then if visible then hide() else show() end if end if mybase.wndproc(m) end sub end class | | |
|