Copyright: Copyright 1994, The Bridge, Inc.


3D Message Box
The 3D Message Box

The Visual Basic MsgBox subroutine and function lacks a three dimensional "look".  The 3D MsgBox replicates the functions provided by VB's MsgBox and adds a three dimensional effect.

Topics:

MsgBox3D Components
Sample VB and 3D Message
MsgBox3D.Frm and MsgBox3D.Bas
MsgBox3DFun, MsgBox3DSub
Converting from VB MsgBox to 3D MsgBox
The Demo Program - MsgDmo3D.Exe
Ordering MsgBox3D
About MsgBox3D

Definitions:

Calling Subroutine MsgBox3DSub
Calling Function MsgBox3DFun
VB Constants used by MsgBox3D
VBRun300.DLL
ThreeD.VBX

Click on one of the above topics or click the Browse button to view additional documentation.

199 California Drive
Millbrae, CA  94030
CompuServe: 71662,205
415-697-2730  Fax: 415-692-3921
Copyright 1994

Last updated: April 10, 1994


Sample VB and 3D Message

VB Message

3D Message


MsgBox3D Components

System components:

MsgBox3D.Frm	Message Box Form
MsgBox3D.Frx	Binary Data
MsgBox3D.Bas	Subroutines, Functions and Globals

Demonstration components:

MsgDmo3D.Exe	Compiled Demo

MsgDmo3D.Mak	VB make file, used to run the demo
MsgDmo3D.Frm	Demonstrates 3D and VB Message Boxes
MsgDmo3D.Frx	Binary Data
MsgDmo3D.Bas	Demo subroutines, etc.
MsgBox3D.Hlp	This Help File

VBRun300.Dll	Visual Basic Runtime Support
ThreeD.VBX	Used for 3D Command effect


MsgBox3D.Frm and MsgBox3D.Bas

To provide three dimensional message box support include MsgBox3D.Frm and MsgBox3D.Bas with your Visual Basic project.  Use the VB File, Add menu option to add the form and module.  You will also need to add ThreeD.VBX.

Calling Sequence

The 3D MsgBox calling sequence is identical to the VB MsgBox calling sequence, except a subroutine is called use MsgBox3DSub.  Call MsgBox3DFun for functions.

See MsgBox3DFun, MsgBox3DSub for details.

Supplied Arguments

VB's MsgBox accepts one, two or three arguments.  MsgBox3D requires that you supply all three arguments.  This is a VB limitation.  See Converting from VB MsgBox to 3D MsgBox.

Constant.Txt

MsgBox3D uses the constants defined in VB's Constant.Txt file.  Be sure to include the message box constants in your project.

###


MsgBox3DFun, MsgBox3DSub

The three dimensional appearing message box displays a message in a dialog box and waits for the user to choose a button.  MsgBox3DFun function returns a value indicating which button the user has chosen; MsgBox3DSub does not.

Function Syntax

return = MsgBox3DFun(message, type, title)

Subroutine Syntax

MsgBox3DSub message, type, title

Remarks

Part	Description

return	Return code supplied by MsgBox3DFun.  Integer data type.

The MsgBox3D function and statement both have these parts:

message	String expression displayed as the message in the dialog box.  String data type.

type	Optional numeric expression that is the sum of values specifying the number and type of buttons to display, the icon style to use, the identity of the default button, and the modality.  Integer data type. The following table illustrates the values used and the meaning of each group of values:

Symbolic Constant	Value	Meaning

MB_OK	0	Display OK button only.

MB_OKCANCEL	1	Display OK and Cancel buttons.

MB_ABORTRETRYIGNORE	2	Display Abort, Retry, and Ignore buttons.

MB_YESNOCANCEL	3	Display Yes, No, and Cancel buttons.

MB_YESNO	4	Display Yes and No buttons.

MB_RETRYCANCEL	5	Display Retry and Cancel buttons.

MB_ICONSTOP	16

MB_ICONQUESTION	32

MB_ICONEXCLAMATION	48

MB_ICONINFORMATION	64

MB_DEFBUTTON1	0	First button is default.

MB_DEFBUTTON2	256	Second button is default.

MB_DEFBUTTON3	512	Third button is default.

MB_APPLMODAL	0	Application modal.  The user must respond to the message box before continuing work in the current application.

MB_SYSTEMMODAL	4096	System modal. The user must respond to the message box before continuing work in any application.

The first group of values (1-5) describes the number and type of buttons displayed in the dialog box; the second group (16, 32, 48, 64) describes the icon style; the third group (0, 256, 512) determines which button is the default; and the fourth group (0, 4096) determines the modality of the message box.  When adding numbers to create a final value for the argument type, use only one number from each group.  If omitted, the default value for type is 0.

title	String expression displayed in the title bar of the dialog box.  If you omit the argument title, MsgBox3D uses 'App.Title' and if none uses 'App.EXEName'.  Display a blank title by setting title to a space.  String data type.

Displaying the Message

MsgBox3D displays as many characters as will fit in a LabelBox.  Longer messages are truncated.

MsgBox3D breaks lines automatically at the right edge of the dialog box.  If you want to set line breaks yourself, place a carriage return [ANSI character 13, Chr$(13)] or a linefeed [ANSI 10, Chr$(10)] before the first character of the text that is to begin each new line.

Returned Value

The MsgBox3D function return value indicates which button has been selected, as shown in the following table:

Symbolic constant	Value	Meaning

IDOK	1	OK button selected.
IDCANCEL	2	Cancel button selected.
IDABORT	3	Abort button selected.
IDRETRY	4	Retry button selected.
IDIGNORE	5	Ignore button selected.
IDYES	6	Yes button selected.
IDNO	7	No button selected.

If the dialog box displays a Cancel button, pressing the Esc key has the same effect as choosing Cancel.

Notes

Note: Symbolic constants for all message box definitions can be found in the Visual Basic file Constant.Txt.  When placed in any module in a project, the symbolic names can be used in all your form and code modules.

Note: Most of this topic has been copied from Microsoft's Visual Basic Help file.  It has been edited, where necessary, to describe MsgBox3D capabilities.

###


Converting from VB MsgBox to 3D MsgBox

Converting

Convert VB MsgBox statements to MsgBox3DSub subroutines.  Convert VB MsgBox functions to MsgBox3DFun functions.  For example the function:

RtnCode = MsgBox(TheMessage, MB_..., TheTitle)

when converted becomes:

RtnCode = MsgBox3DFun(TheMessage, MB_..., TheTitle)

Add Files

Add, if necessary, the following files to the VB project:

MsgBox3D.Frm	Message Box Form
MsgBox3D.Bas	Subroutines, Functions and Globals
Constant.Txt 	Constants [MB_...] used by MsgBox3D
ThreeD.VBX	Used for 3D Command effect

Considerations

Same Number of Arguments - The type and title are not required with VB MsgBox, they are required with 3D MsgBox.  A VB limitation - Argument Count Mismatch.

Data Type - The data type of the parameters passed to or returned from VB MsgBox can be variant.  They must be either string or integer with 3D MsgBox.  A VB limitation - Parameter Type Mismatch.

###


The Demo Program - MsgDmo3D.Exe

Program MsgDmo3D.Exe demonstrates the similarities and differences between VB's MsgBox and MsgBox3D.  You may wish to review VB's help topic "MsgBox Function, MsgBox Statement."  MsgBox3D replicates the functionality of VB's MsgBox.  MsgDmo3D is written in VB 3.0.  It uses VBRun300.Dll.  Click on the following form for additional information about each section of the demo screen:

Select desired option buttons then click the VB MsgBox or 3D MsgBox commands to display the standard or 3D message.  Enter new message or title text to display a message containing that text.

###


Ordering MsgBox3D
MsgBox3D Order Form

Use WinHelp's print topic function [File, Print Topic] to print this order form.

MsgBox3D Components:

MsgBox3D.Frm	VB Source
MsgBox3D.Frx	Binary Data for above
MsgBox3D.Bas	Subroutines, Functions, Globals
MsgBox3D.Ico	Icon
MsgBox3D.Hlp	Help File
MsgDmo3D.Frm	Demo Source
MsgDmo3D.Frx	Binary Data for above
MsgDmo3D.Bas	Demo Subroutines
MsgDmo3D.Mak	VB Make File for Demo
ThreeD.Vbx	3D Controls
ReadMe.Txt	Current Information

Send MsgBox3D to:

Name:	_________________________________________

Company:	_________________________________________

Address:	_________________________________________

City/State/ZIP	_________________________________________

Phone:	_________________________________________

CompuServe:	_________________________________________

Price:

Product: 	$4.95 US  [California purchases, add appropriate sales tax.]

Shipping: 	$2.95 by US Postal Service, $1.95 by CompuServe

Payment Method:

Check          Visa          MasterCard

If Credit Card, Number: ________________________________,
Expires: ________  or order by phone: 415-697-2730

If Check, make payable to and Mail to:

199 California Drive
Millbrae, CA  94030


About MsgBox3D

While displaying a 3D message, click the right mouse button on a MsgBox3D Icon, or press F12, to display an "About" box.


Calling Subroutine MsgBox3DSub

A typical MsgBox3DSub calling sequence:

MsgBox3DSub message, type, title

For example:

MsgBox3DSub "A Sample Message", MB_IconQuestion + MB_OKCancel, "Title"

will create a three dimensional message box with a message and title as well as display a question mark icon and an OK and a Cancel button.

definition


Calling Function MsgBox3DFun

A typical MsgBox3DFun calling sequence:

RtnCode = MsgBox3DFun (message, type, title)

For example:

RtnCode = MsgBox3DFun ("Sample Message", MB_OKCancel, "Title")

will create a three dimensional message box with a message and title as well as an OK and a Cancel button.  If the user clicks the OK button RtnCode will contain IDOK [1], otherwise it will contain IDCancel [2].


VB Constants used by MsgBox3D

' MsgBox parameters
    Global Const MB_OK = 0	' OK button only
    Global Const MB_OKCANCEL = 1	' OK and Cancel buttons
    Global Const MB_ABORTRETRYIGNORE = 2	' Abort, Retry, and Ignore buttons
    Global Const MB_YESNOCANCEL = 3	' Yes, No, and Cancel buttons
    Global Const MB_YESNO = 4	' Yes and No buttons
    Global Const MB_RETRYCANCEL = 5	' Retry and Cancel buttons
    Global Const MB_ICONSTOP = 16	' Critical message
    Global Const MB_ICONQUESTION = 32	' Warning query
    Global Const MB_ICONEXCLAMATION = 48	' Warning message
    Global Const MB_ICONINFORMATION = 64	' Information message
    Global Const MB_DEFBUTTON1 = 0	' First button is default
    Global Const MB_DEFBUTTON2 = 256	' Second button is default
    Global Const MB_DEFBUTTON3 = 512	' Third button is default
    Global Const MB_APPLMODAL = 0	' Application Modal Message Box
    Global Const MB_SYSTEMMODAL = 4096	' System Modal
' MsgBox return values
    Global Const IDOK = 1	' OK button pressed
    Global Const IDCANCEL = 2	' Cancel button pressed
    Global Const IDABORT = 3	' Abort button pressed
    Global Const IDRETRY = 4	' Retry button pressed
    Global Const IDIGNORE = 5	' Ignore button pressed
    Global Const IDYES = 6	' Yes button pressed
    Global Const IDNO = 7	' No button pressed


VBRun300.DLL - VB Dynamic Link Library

The demo program is written in Visual Basic.  VBRun300.DLL is needed to run the demo.  Make sure the Windows/System directory contains a copy of this Dynamic Link Library.


ThreeD.VBX - Three Dimensional Control
ThreeD.VBX - Three Dimensional Controls

ThreeD.VBX is distributed with Visual Basic.  MsgBox3D uses its three dimensional command support. Add this VBX to your project if you plan to use MsgBox3D.


Buttons

Select the command button configuration to be displayed with the message box.  In this example the Yes, No and Cancel buttons will be displayed.


Default Button

If more than one command button is displayed, set the default button by selecting one of the Default Button options.  In the example the third [Cancel] button becomes the default


Icon
Icons

Select an Icon to be displayed with the 3D message.  In this example an Information Icon will be displayed.


Modal Type

The Windows API supports either Application wide or System wide modal window display.  An Application wide modal form must be "unloaded" before other forms in that application can be selected - other applications can be selected.  A System wide modal window must be "unloaded" before any other application can be selected.

MsgBox3D uses Window's API SetSysModalWindow to set a system wide modal message.  There are a few differences between the VB MsgBox and 3D MsgBox displayed in system modal form.  Differences:

VB MsgBox

No Title or Control Box in some cases.
No border in some cases.

3D MsgBox

Always have a Title and Control Box.
Always have a border.


Subroutine or Function

Select either a subroutine or function option.  In this example the Function option was selected.


Message

Message - Enter any desired message.

Carriage Return or Line Feed - You can use two vertical bars ( || ) to represent a carriage return.  Use two backslashes ( \\ ) to represent a line feed.  The demo program converts these to an appropriate special character before calling MsgBox3D.

For example:

This is the first line.||This is the second.||This is the third.

Is displayed in the message box as:

This is the first line.
This is the second.
This is the third.

Note: MsgBox3D does not perform the conversion.  The message text you supply to MsgBox3D must contain a carriage return or line feed if you want a line break to occur.


Title

Title - Enter any desired title.  Maximum length is 78 characters.  If blank, MsgBox3D will first use App.Title then App.EXEName.  Display a "blank" title by entering at least one space.


Return Code

Return Code - The value returned by the MsgBox3DFun indicates which button was selected.  In this example the "Yes" button was selected.  See: MsgBox3DFun, MsgBox3DSub for valid return codes.


Standard VB Message

Click the VB Message command to display a standard Visual Basic message.


3D Message

Click the 3D Message command to display a three dimensional message.