home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form Form1
- Caption = "Menu Tips Demo"
- ClientHeight = 1755
- ClientLeft = 2220
- ClientTop = 2805
- ClientWidth = 4365
- Height = 2445
- Left = 2160
- LinkTopic = "Form1"
- ScaleHeight = 1755
- ScaleWidth = 4365
- Top = 2175
- Width = 4485
- Begin MsgHook MsgHook
- Left = 120
- Top = 120
- End
- Begin Label lblStatusBar
- BackColor = &H00C0C0C0&
- BorderStyle = 1 'Fixed Single
- Caption = "lblStatusBar"
- Height = 255
- Left = 720
- TabIndex = 0
- Top = 120
- Width = 3495
- End
- Begin Menu mnuFile
- Caption = "&File"
- Begin Menu mnuFileExit
- Caption = "E&xit"
- End
- End
- Begin Menu mnuEdit
- Caption = "&Edit"
- Begin Menu mnuArray
- Caption = "Cu&t"
- Index = 1
- Shortcut = ^X
- End
- Begin Menu mnuArray
- Caption = "&Copy"
- Index = 2
- Shortcut = ^C
- End
- Begin Menu mnuArray
- Caption = "&Paste"
- Index = 3
- Shortcut = ^V
- End
- Begin Menu mnuArray
- Caption = "&Delete"
- Index = 4
- Shortcut = {DEL}
- End
- End
- Option Explicit
- ' Windows constants
- Const WM_MENUSELECT = &H11F
- Dim DefaultText As String
- Sub Form_Load ()
- ' Setup MsgHook
- MsgHook.HwndHook = Me.hWnd
- MsgHook.Message(WM_MENUSELECT) = True
- DefaultText = "Ready"
- lblStatusBar = DefaultText
- End Sub
- Sub Form_Resize ()
- ' Size label to status bar area (for users who don't have VB pro edition)
- lblStatusBar.Move 0, ScaleHeight - lblStatusBar.Height, ScaleWidth
- End Sub
- Sub mnuArray_Click (Index As Integer)
- ' Display message for dummy commands
- MsgBox "This command is not implemented"
- End Sub
- Sub mnuFileExit_Click ()
- Unload Me
- End Sub
- Sub MsgHook_Message (msg As Integer, wParam As Integer, lParam As Long, result As Long)
- Dim txtStatus As String
- If msg = WM_MENUSELECT Then
- Select Case wParam
- Case 0
- txtStatus = DefaultText
- Case 2
- txtStatus = "Exits this program"
- Case 4
- txtStatus = "Cuts the selected items to the clipboard and deletes them"
- Case 5
- txtStatus = "Copies the selected items to the clipboard"
- Case 6
- txtStatus = "Pastes the contents of the clipboard to the current location"
- Case 7
- txtStatus = "Deletes the selected items"
- Case Else
- txtStatus = ""
- End Select
- lblStatusBar = txtStatus
- result = 0
- End If
- End Sub
-