A combination of the first examples. The source code is here:

  • Add 'Maximize'/'Minimize' and 'Resize' styles.
  • Remove the extended style 'DialogFrame'. The effect being: The system menu becomes visible (it was already there).
  • Change the contents of the system menu.
  • Add WndProc to handle the additional menu items; an 'Event-Handler'.

Like so:


Public Function WndProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

'---------------------------------------------------------------------------------------
'user form's event handler

   Select Case uMsg
      Case WM_SYSCOMMAND         'menu selected
         Select Case wParam      'which menu item
            Case 1               'If About (ID = 1) was selected
               MsgBox "About SysMenu Demo", vbOKOnly Or vbInformation, strMakro & " " & strVersion
               WndProc = 0       'clear message
            'Case 2              'menu item 2
            
         End Select
            
      End Select
      ' Here, we forward all irrelevant messages on to the default message handler.
      WndProc = CallWindowProc(oldWndProc, hwnd, uMsg, wParam, lParam)
End Function

 The result of our changes:

WndProc handles the click on 'About' and shows a MessgeBox:

Other program routines could be called instead.

Go to top