VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

mAboutDialog

Riaan Aspeling  (14 Submissions)   Windows System Services   Visual Basic 3.0   Unknown Difficulty   Wed 3rd February 2021

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).

Inputs
Call the code from your main form like so: 'Private Sub Form_Load() ' Call AddAboutForm(Me.hwnd, "About..") 'End Sub

Returns
It will check windows system messages for the click event on the system menu and then display your own FRMAbout.

Side Effects
DO NOT TRY AND STEP THIS CODE. Windows is doing calles to the function's in this module and could give you a GPF...

API Declarations
'Paste this code into a module mAboutDialog
'
Option Explicit
'To variables and const we need
Public OldProcedure As Long
Public Const ABOUT_ID = 1010
Public Const WM_SYSCOMMAND = &H112
Public Const MF_SEPARATOR = &H800
Public Const MF_STRING = &H0
Public Const GWL_WNDPROC = &HFFFFFFFC
'The API's we need to do this
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Declare Function AppendMenu Lib "user32" Alias "AppendMenuA" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As Any) As Long
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Rate mAboutDialog (10(10 Vote))
mAboutDialog.bas

mAboutDialog Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters