How-To... - Create an About Box - Quick and easy

Every application should have one. What a better way to show off to the user that you made this program, give them contact details, hide an easter egg(most apps hide them there, just check IE4) and information on the program. Some people design their own About boxes, and others, like the Microsoft team :-) made an API call to let Windows create on for you.

In a standard module insert the ShellAbout function, below:-

Declare Function ShellAbout Lib "shell32.dll" Alias "ShellAboutA" _
(ByVal hwnd As Long, ByVal szApp As String, ByVal szOtherStuff As _
String, ByVal hIcon As Long) As Long

Now, insert the following code in a control's Click() procedure:-

'Here is the call that makes the About Box.

'Re-cap of the function - '

'Declare Function ShellAbout Lib "shell32.dll" Alias "ShellAboutA" _
' (ByVal hwnd As Long, ByVal szApp As String, ByVal szOtherStuff As _
' String, ByVal hIcon As Long) As Long '

'hwnd - the window handle of the form(just leave it as me.hwnd)
'szApp - the name of the Application which is put in the title of
'the box...
'szOtherStuff - any other comments - NOTE: You can only have
'85 characters.
'hIcon - an icon to use for the About Box - usually the Forms icon...

Call ShellAbout(Me.hwnd, "-About Box Example", "A small example " & _
"that uses the ShellAbout Function to create an About Box.", frmMain.Icon)

Now, run the program. Click the control, and the About Box will apear, similar to the one in the screenshot.

You can download this example by clicking here


This site is Copyright © 1999 of David Cowan. VB How-To, Dodgesoft and DodgeSoft Productions is Copyright © 1999 of David Cowan. Source-code and programs are copyright of their respective owners. For a messageboard, click here