|
制作可以自动隐藏的弹出式菜单(4) Begin VB.Menu mnuItem3 Caption = "Item&3" End End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_EXPosed = False Option Explicit Private Sub Form_Load() 'MsgBox ClassName(Me.hWnd) LblNow.Caption = Now Hook Me.hWnd End Sub Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) LblClick_MouseUp Button, Shift, X, Y End Sub Private Sub Form_Unload(Cancel As Integer) UnHook Me.hWnd End Sub Private Sub LblClick_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button And vbKeyRButton Then 'ShowMsg = True PopupMenu mnuPopup 'ShowMsg = False End If End Sub Private Sub Timer1_Timer() LblNow.Caption = Now '这样即使不移动鼠标,菜单也会自动隐藏 If ChkTime Then ChkExit End If End Sub Module1.bas ==================================================================== Attribute VB_Name = "Module1" Option Explicit
'## API ########################################
|