Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Expertise: Beginner
Aug 6, 1997



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Instant About Boxes

The ShellAbout API call provides a quick and easy way to show an about box (using the standard Win95 format) without having to include an additional form in your project. The call uses four parameters: the hWnd of your main dialog, a string containing the name of your application, another string containing an optional additional line of text, and a long pointer to the handle of an icon. Start by placing this code in a BAS module:
 Global Const GWW_HINSTANCE = (-6)

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
Declare Function ExtractIcon Lib "shell32.dll" _ 
	Alias "ExtractIconA" (ByVal hInst As Long, _
	ByVal lpszExeFileName As String, ByVal _
	nIconIndex As Long) As Long
Declare Function GetWindowLong Lib "user32" _
	Alias "GetWindowLongA" (ByVal hwnd As Long, _
	ByVal nIndex As Long) As Long
Add this routine to a button or menu to call your about box:
	Dim lRet As Long
	Dim lNull As Long
	Dim lIcon As Long
	Dim lInst As Long

	lInst = GetWindowLong_
		(Form1.hwnd, GWW_HINSTANCE)

	lIcon = ExtractIcon(lInst, "MYEXE.EXE", 0&) 

	lRet = ShellAbout(Form1.hwnd, _
		"My App Name", "Copyright © 1995 _
		My Company Name" & Chr(13) & _
		Chr$(10) & "Serial # xxxxxxxxx-xxx", lIcon)
lRet will return true if the dialog was able to display and false if there was a problem. All of the required functions operate in both Windows 95 and Windows NT.
MicroHelp Uninstaller
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date