VB realizes the Boss key function

Source: Internet
Author: User
Tags modifiers

Long time no use of VB, made a small thing, with a very comfortable:)

Frmmain.frm

'---------------------------------------------------------------------------------------
' Author: Ah Xi
' Purpose:vb realize the simple function of the Boss key
'---------------------------------------------------------------------------------------

Sub Form_Load () Sub Form_Load ()
DIM ret as Long
Prewinproc = GetWindowLong (Me.hwnd, GWL_WNDPROC)
ret = SetWindowLong (Me.hwnd, GWL_WNDPROC, AddressOf WNDPROC)
Idhotkey = 1
' Hold down ctrl+q to implement the switch
modifiers = Mod_control
Uvirtkey = Vbkeyq
ret = RegisterHotKey (Me.hwnd, Idhotkey, modifiers, Uvirtkey)
' Min Flower to Tray
Trayaddicon frmmain, App.Path & "\pbs.ico", "System tray"
End Sub

Sub Form_Unload () Sub Form_Unload (Cancel as Integer)
DIM ret as Long
ret = SetWindowLong (Me.hwnd, GWL_WNDPROC, Prewinproc)
Call Unregisterhotkey (Me.hwnd, Uvirtkey)
' Remove tray icon when exiting
Trayremoveicon
End Sub

Sub Form_resize () Sub Form_resize ()

' Window minimized
If me.windowstate = vbminimized Then me.hide

End Sub

Sub Form_mousemove () Sub Form_mousemove (Button As Integer, Shift As Integer, X as single, Y as single)

' Mouse event when bubble clicks
Dim result as Long
Dim CEvent as Single
CEvent = X/screen.twipsperpixelx

Select Case CEvent

Case MouseMove
Trayballoon frmmain, "One key hidden program v0.1 by a XI", Niif_info
Case Leftup

Case Leftdown
Frmmain. WindowState = 0
Frmmain. Show
Case Leftdbclick

Case Middleup

Case Middledown

Case Middledbclick

Case Rightup

Case Rightdown

Case Rightdbclick

Case Balloonclick

End Select

End Sub

Sub Label1_click () Sub Label1_click ()

End Sub

Sub Label2_click () Sub Label2_click ()

End Sub

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.