Page 182 - DCAP408_WEB_PROGRAMMING
P. 182
Windows Programming
Notes ByVal lParam As Long) As Long
’// menu windows api
Declare Function AppendMenu Lib “user32” Alias “AppendMenuA” (ByVal hMenu
As Long,
ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As String)
As Long
Declare Function GetSystemMenu Lib “user32” (ByVal hWnd As Long, ByVal
bRevert As Long)
As Long
’// windows api constants
Public Const WM_SYSCOMMAND = &H112
Public Const MF_SEPARATOR = &H800&
Public Const MF_STRING = &H0&
Public Const GWL_WNDPROC = (-4)
Public Const IDM_ABOUT As Long = 1010
Public Function WindowProc(ByVal hWnd As Long, ByVal iMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
‘// ——WARNING——
‘// do not attempt to debug this procedure!!
‘// ——WARNING——
‘// this is our implementation of the message handling routine
‘// determine which message was received
Select Case iMsg
Case WM_SYSCOMMAND
If wParam = IDM_ABOUT Then
MsgBox “VB Web Append to System Menu Example”, vbInformation,
“About”
Exit Function
End If
End Select
‘// pass all messages on to VB and then return the value to windows
WindowProc = CallWindowProc(ProcOld, hWnd, iMsg, wParam, lParam)
End Function
Add New Menu To System Menu
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
176 LOVELY PROFESSIONAL UNIVERSITY