mAboutDialog
How would you like to have your own About menu option on the little system menu on the top left-hand corner of your form. I whould , so I wrote a module to do it with one line of code from the Load event on my form. For this code to work you have to create a About form first (FRMAbout).
AI
Riepilogo AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Codice sorgente
'Paste this code into a module mAboutDialog
'
'This is a subs function for windows system menu calls
Public Function SubsMenuProc(ByVal lFRMWinHandel As Long, ByVal lMessage As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'Only capture system commands
Select Case lMessage
Case WM_SYSCOMMAND
'Only capture our new about menu's clicks
If wParam = ABOUT_ID Then
'Show the about box
FRMAbout.Show 1
Exit Function
End If
End Select
'Do the rest of windows stuff
SubsMenuProc = CallWindowProc(OldProcedure, lFRMWinHandel, lMessage, wParam, lParam)
End Function
'This function should be called from the Onload event of the form you want
'the system menu to contain a About Menu
Public Sub AddAboutForm(ByVal lFormWindowHandel As Long, MenuDescription As String)
Dim hSysMenu As Long
'Get the handel to the system menu
hSysMenu = GetSystemMenu(lFormWindowHandel, 0&)
'Add a nice line
Call AppendMenu(hSysMenu, MF_SEPARATOR, 0&, 0&)
'Make sure you have a menu description
If MenuDescription = "" Then MenuDescription = "About"
'Add the About menu description
Call AppendMenu(hSysMenu, MF_STRING, ABOUT_ID, MenuDescription)
'Direct windows to the new function for the menu
OldProcedure = SetWindowLong(lFormWindowHandel, GWL_WNDPROC, AddressOf SubsMenuProc)
End Sub
Commenti originali (3)
Recuperato da Wayback Machine