Dec 222017
 
Visual Basic Knowledge Base #1.
File VBKBASE1.ZIP from The Programmer’s Corner in
Category BASIC Language
Visual Basic Knowledge Base #1.
File Name File Size Zip Size Zip Type
TPCREAD.ME 199 165 deflated
VBKBASE1.DES 93 88 deflated
VBKBASE1.TXT 145164 38522 deflated

Download File VBKBASE1.ZIP Here

Contents of the VBKBASE1.TXT file


Microsoft Knowledge Base on Compuserve 9/18/91
"Visual Basic" anywhere in document
Part 1 thru June 25, 1991


Title: How to Create a System-Modal Program/Window in Visual Basic
Document Number: Q72674 Publ Date: 6-JUN-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
From a Visual Basic program, you can disable the ability to switch to
other Windows programs by calling the Windows 3.0 API function
SetSysModalWindow.
This information applies to Microsoft Visual Basic programming system
version 1.0 for Windows.
More Information:
Microsoft Windows is designed so that the user can switch between
applications without terminating one program to run another program.
There may be times when the program needs to take control of the
entire environment and run from only one window, restricting the user
from switching to any other application. An example of this is a
simple security system; or a time-critical application that may need
to go uninterrupted for long periods of time.
Passing the handle to the window through the argument of
SetSysModalWindow will limit the user to that particular window. This
will not allow the user to move to any other applications with the
mouse or use ALT+ESC or CTRL+ESC to bring up the Task Manager. You
could even remove the system menu if you do not want the user to exit
through the ALT+F4 (Close) combination.
All child windows that are created by the system-modal window become
system-modal windows. When the original window becomes active again,
it is system-modal. To end the system-modal state, destroy the
original system-modal window.
Care must be taking when using the SetSysModalWindow API from within
the Visual Basic programmer's environment. Pressing CTRL+BREAK to get
to the [break| mode leaves your modal form with no way to exit unless
you restart your system. When using the SetSysModalWindow within the
environment, be sure to exit your application by destroying the window
with either the ALT+F4 in the system menu, or by some other means from
within your running program.
To use the SetSysModalWindow API function, declare the API call in
your global section:
Declare Function SetSysModalWindow Lib "User" (ByVal hwnd%) As Integer
At an appropriate place in your code, add the following:
Success% = SetSysModalWindow(hwnd)
Once this line is executed, your window will be the only window that
can get focus until that window is destroyed.
Reference:
1. "Programming Windows: the Microsoft Guide to Writing Applications
for Windows 3," by Charles Petzold (published by Microsoft Press, 1990)
2. "Microsoft Windows 3.0 Software Development Kit: Reference Volume 1"
3. The WINSDK.HLP file shipped with Microsoft Windows 3.0 Software
Development Kit.

Knowledge Base

Title: VB "Out of Stack Space" with LoadPicture in Form_Paint Event
Document Number: Q72675 Publ Date: 6-JUN-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
An "Out of stack space" error can occur when you use a LoadPicture
method within a Form_Paint event.
This information applies to Microsoft Visual Basic programming system
version 1.0 for Windows.
More Information:
The Visual Basic stack can be exhausted when the LoadPicture method is
executed within a [control/form|_Paint event. The LoadPicture method
generates a [control/form|_Paint event itself, and when performed
within a _Paint event, the program will repeat the cycle until the
stack is exhausted.
The following code example demonstrates that the Form_Paint event is a
recursive procedure when a LoadPicture method is included in the
_Paint event code.
After you add the code to your program, run the program and notice how
many times the message "Form_Paint Count :" is displayed within the
Immediate Window before you receive the "Out of stack space" error
message.
Sub Form_Paint ()
Static Count
Count = Count + 1
Debug.Print "Form_Paint Count : "; Count
Form1.picture = LoadPicture("c:\windows\chess.bmp")
End Sub
To remedy the situation, move the LoadPicture to another event
handler, such as the Form_Load event. Since these bitmaps are
automatically refreshed when needed, you don't have to maintain the
picture within a Paint event.
The Visual Basic stack is limited to 16K bytes, and cannot be changed.

Knowledge Base

Title: "Method Not Applicable For This Object" with SetFocus
Document Number: Q72676 Publ Date: 6-JUN-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
Visual Basic will return "Method Not Applicable For This Object"
whenever you use the SetFocus method on a control that is on a form
that is not visible.
This information applies to Microsoft Visual Basic programming system
version 1.0 for Windows.
More Information:
A control needs to be visible before you can execute the SetFocus
method to that control. To make a control visible, the form must be
loaded and the Visible property for the control must also be True
{-1}.
As an example, create two forms, and on each form, create a command
button.
In the code segment that follows, Form2 is not loaded yet, so you must
show Form2 before you can set the focus to Form2.Command1. Once Form2
has been loaded, you can set the focus to the visible control
Form2.Command1. When you click the Form1.Command1 twice, you will
receive the error "Method Not Applicable For This Object" because
Form2.Command1's visible property was set to false during the previous
call to Form_Click.
'* This is the load event for Form1.
Sub Form_Load ()
Form2.Show
Form2.Command1.Visible = 0 'this is the default setting
End Sub
'* This is the click event for Form1.Command1
Sub Command1_Click ()
Form2.Command1.SetFocus
Form2.Command1.Visible = 0 'hide the control
End Sub

Knowledge Base

Title: How to Limit User Input In VB Combo/Text Box; SendMessage API
Document Number: Q72677 Publ Date: 6-JUN-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
You can specify a limit to the amount of text that can be entered into
a text and/or combo box by calling SendMessage (a Windows 3.0 API
function) with the EM_LIMITTEXT constant.
This information applies to Microsoft Visual Basic programming system
version 1.0 for Windows.
More Information:
The constant EM_LIMITTEXT can be sent to the SendMessage Windows 3.0
API function to limit the length of a string entered into a combo
and/or text box.
Another method is to check the length of a string inside a KeyPress
event for the control. If the length is over a specified amount, then
the formal argument parameter KeyAscii will be set to zero.
A cleaner way is to use the SendMessage API function call. After you
set the Focus to the desired edit control, you must send a message to
the window's message queue, which will reset the text limit for the
control. The argument, EM_LIMITTEXT, as the second parameter to
SendMessage will set the desired text limit based on the value
specified by the third arguments. The SendMessage function requires
the following parameters for setting the text limit:
SendMessage (hWnd%,EM_LIMITTEXT, wParam%, lParam)
wParam% Specifies the maximum number of bytes that can be
entered. If the user attempts to enter more
characters, the edit control beeps and does not accept
the characters. If the wParam parameter is zero, no
limit is imposed on the size of the text(until no more
memory is available)
lParam Is not used.
As an example, do the following:
1. Create a form called Form1.
2. Add to Form1 a combo box called Combo1.
3. Add the following code to the general declarations section of the
form:
'*** Note: Each Declare statement must be on just one line:
Declare Function GetFocus% Lib "user" ()
Declare Function SendMessage& Lib "user" (ByVal hWnd%,
ByVal wMsg%,
ByVal wParam%,
lp As Any)
Declare Function PutFocus% Lib "user" Alias "SetFocus"
(ByVal hWnd%)
Const WM_USER = &H400
Const EM_LIMITTEXT = WM_USER + 21
4. Add the following code to the Form_Load event procedure:
Sub Form_Load ()
Form1.Show 'Must show form to work on it
Combo1.SetFocus 'Set the focus to the list box
cbhWnd% = GetFocus() 'Get the handle to the list box
TextLimit% = 5 'Specify the largest string
retVal = SendMessage(cbhWnd%, EM_LIMITTEXT, TextLimit%, 0)
End Sub
5. Run the program and enter some text into the combo box. You will
notice that you will only be able to enter a string of five
characters into the combo box.
Reference:
1. "Programming Windows: the Microsoft Guide to Writing Applications
for Windows 3," by Charles Petzold (published by Microsoft Press, 1990)
2. "Microsoft Windows 3.0 Software Development Kit: Reference Volume 1"
3. The WINSDK.HLP file shipped with Microsoft Windows 3.0 Software
Development Kit.

Knowledge Base

Title: VB Debug.Print in MouseMove Event Causes MouseMove Event
Document Number: Q72679 Publ Date: 6-JUN-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
Debug.Print used within the MouseMove event procedure of a form or
control causes a MouseMove event. If the mouse cursor is located
within the form or control, an endless stream of output to the
Immediate Window will occur. This behavior occurs for a program run in
the Visual Basic development environment. An .EXE program does not
utilize the Immediate Window and the Debug object so this behavior
does not apply to a .EXE program. The problem does not occur if a
Print method is issued to any other form or control in the program.
This is not a problem with Visual Basic, but rather the nature of the
Microsoft Windows operating environment.
This information applies to Microsoft Visual Basic programming system
version 1.00 for Windows.
More Information:
If Debug.Print is used within the MouseMove event procedure of a form
or control, an endless stream of output is sent to the Immediate
Window. This occurs whenever the mouse cursor is within the form or
control. This behavior occurs because the Debug.Print statement causes
the focus to change briefly to the Immediate Window. When the focus
returns to the form or control, Windows generates a MouseMove event
that is processed by Visual Basic. There is no way for Visual Basic to
suppress MouseMove events that are generated by Windows. The easiest
way to overcome this behavior is to send debug output to another form
or control.
To duplicate this behavior, create a picture control (Picture1) within
the default form (Form1). Add the following code segment to the
MouseMove event procedure of Picture1:
Sub Picture1_MouseMove (Button As Integer, Shift As Integer,
X As Single, Y As Single)
' You must write the above Sub statement on just one line.
Static i%
i% = i% + 1
Debug.Print i%
End Sub
If you want output to be sent only when the mouse is moved, then all
Debug.Print statements within the MouseMove event procedure should be
changed to Print methods to other forms or controls. Below is a
description of how to modify the example above such that output is
produced only when the mouse is moved.
Add another form (Form2) to the project by selecting New Form from the
File menu (ALT F+F). Change the Debug.Print statement in the MouseMove
event procedure for Picture1 to Form2.Print. Below is a copy of the
above sample modified to send output to another form.
Sub Picture1_MouseMove (Button As Integer, Shift As Integer,
X As Single, Y As Single)
' You must write the above Sub statement on just one line.
Static i%
i% = i% + 1
Form2.Print i%
End Sub
In the example above, all output that scrolls off the form will be
lost. A more sophisticated routine will be required to keep track of
all output to the form. Such a routine is beyond the scope of this
article.

Knowledge Base

Title: Why Cooper Software Is Listed in Visual Basic's Copyright
Document Number: Q72747 Publ Date: 12-JUN-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
The Microsoft Visual Basic copyright notice acknowledges Cooper
Software in both the sign-on dialog box and in the About dialog box
from the Help menu. Visual Basic uses technology from a forms engine
purchased from Cooper Software. The acknowledgment in Visual Basic is
part of the contract between Microsoft and Cooper Software.
This information applies to Microsoft Visual Basic programming system
version 1.0 for Windows.

Knowledge Base

Title: How to Trap a VB Form's Lost Focus with GetActiveWindow API
Document Number: Q69792 Publ Date: 20-MAY-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
The LostFocus event in Microsoft Visual Basic is useful when
transferring control within an application. However, no global routine
exists to check for the entire form losing the focus. One method to
use to check whether your Visual Basic application has lost the focus
is the Windows API call GetActiveWindow, as explained below.
This information applies to Microsoft Visual Basic programming
system version 1.00 for Windows.
More Information:
The only way for a Visual Basic application to check for loss of focus
is to trigger the LostFocus event. A form does support a LostFocus
event; however, a form will only get focus if there are no controls on
that form. Focus goes to the controls on a form, and when you click
any other visible form or window, the control's LostFocus procedure
will be called. A control's LostFocus procedure will also be called
when another control on the form is activated. To perform a routine
that occurs only when the form loses focus requires careful management
of what generated a LostFocus event on each control (such as setting a
flag if another control's Click event was called).
For a simpler method to check if a whole form has lost the focus, you
can call the Windows API function GetActiveWindow, located in USER.DLL
in Windows 3.00. The GetActiveWindow API call returns the window
handle of the active window, which is the new window that you clicked.
In every LostFocus procedure for every control on the old form, you
would call GetActiveWindow and compare the return value with the old
form's window handle (hWnd). The following program example
demonstrates this technique:
Program Example
---------------
This single-form example will print "Lost Focus" on the form when you
click a different window (such as when you click another program
running in Windows).
In Visual Basic, create one command button, Command1, on a single
form, Form1.
From VB.EXE's Code menu, choose View Code, and enter the following
code for Form1 [using (general) from the Object box, and
(declarations) from the Procedure box|:
Declare Function GetActiveWindow Lib "User" () As Integer
From the Object box, choose Command1, and from the Procedure box,
choose LostFocus, and then put the following code in the
Command1_LostFocus procedure:
Sub Command1_LostFocus ()
If GetActiveWindow() <> Form1.hWND Then
'Do form's lost-focus routines here.
Print "Lost Focus"
End If
End Sub
You can now run the program.
Reference:

Knowledge Base

Title: How to Create Scrollable Viewports in Visual Basic
Document Number: Q71068 Publ Date: 20-MAY-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
Scrollable viewports can be created within Visual Basic using standard
Basic calls. The viewports can include bitmaps, graphics, or other
controls.
This information applies to Microsoft Visual Basic Programming System
version 1.00 for Windows.
More Information:
To create a scrollable picture with clipping, you must have two
picture controls. The first picture control is called the stationary
parent picture control. Within the parent picture control, you need to
create a movable child picture control. It is the child picture
control that will be moved within the parent picture control. Moving
the child picture within the parent picture control creates the
clipping effect. During run time when you move the child picture, it
will now be clipped by the boundaries of the parent picture.
To create these two picture controls, do the following:
1. Choose the picture box control from the Toolbox window in Visual
Basic.
2. Draw a picture on the form. This is the parent picture.
3. Again choose the picture box control from the Toolbox window.
4. Draw the second picture on top of and within the boundaries of
the first picture control. This is the child picture.
The sample application below shows how to create a scrollable bitmap
within a viewport. Perform the sequence above to create a parent/child
picture control. Add a horizontal scroll bar and a vertical scroll bar
to the form.
Make sure that the path to your bitmap is correct. Several of the
properties are set during run time, which could have been set during
design time as well.
Moving the thumb of the two scroll bars will move the child picture
within the parent picture. The handle (upper-left corner of the
picture) to the child picture will be located either at (0,0) of the
parent picture or to the left and/or right of the parent picture.
Since the clipping region is that of the parent picture, the child
picture will appear to move across the parent picture viewport.
Sub Form_Load ()
Const PIXEL = 3
Const TRUE = -1
Const NONE = 0
' Set design properties, included here for simplicity.
Form1.ScaleMode = PIXEL
Picture1.ScaleMode = PIXEL
Picture2.ScaleMode = PIXEL
' AutoSize is set to TRUE so that the boundaries of
' Picture2 are expanded to the size of the actual bitmap.
Picture2.AutoSize = TRUE
' Get rid of annoying borders.
Picture1.BorderStyle = NONE
Picture2.BorderStyle = NONE
' Load the picture that you want to display.
Picture2.Picture = LoadPicture("c:\win\party.bmp")
' Initialize location of both pictures.
Picture1.Move 0, 0, ScaleWidth - VScroll1.Width,_
ScaleHeight - HScroll1.Height
Picture2.Move 0, 0
' Position the horizontal scroll bar.
HScroll1.Top = Picture1.Height
HScroll1.Left = 0
HScroll1.Width = Picture1.Width
' Position the vertical scroll bar.
VScroll1.Top = 0
VScroll1.Left = Picture1.Width
VScroll1.Height = Picture1.Height
' Set the Max value for the scroll bars.
HScroll1.Max = Picture2.Width - Picture1.Width
VScroll1.Max = Picture2.Height - Picture1.Height
' Determine if child picture will fill up screen.
' If so, then there is no need to use scroll bars.
VScroll1.Enabled = (Picture1.Height < Picture2.Height)
HScroll1.Enabled = (Picture1.Width < Picture2.Width)
End Sub
Sub HScroll1_Change ()
' Picture2.Left is set to the negative of the value because
' as you scroll the scroll bar to the right, the display
' should move to the Left, showing more of the right
' of the display, and vice-versa when scrolling to the
' left.
Picture2.Left = -HScroll1.Value
End Sub
Sub VScroll1_Change ()
' Picture2.Top is set to the negative of the value because
' as you scroll the scroll bar down, the display
' should move up, showing more of the bottom
' of the display, and vice-versa when scrolling up.
Picture2.Top = -VScroll1.Value
End Sub

Knowledge Base

Title: How to Clear a VB List Box with a Windows API Function
Document Number: Q71069 Publ Date: 20-MAY-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
Customers commonly ask how to quickly clear the contents of a list box
without clearing one item at a time. The following article shows how
to instantly clear the contents of a list box by sending the list box
a LB_RESETCONTENT message.
This information applies to Microsoft Visual Basic Programming System
version 1.00 for Windows.
More Information:
There is no single command within Visual Basic that will clear out the
entries of a list box. However, by using the SendMessage function, you
can clear out the list box with one command. The arguments to
SendMessage with the LB_RESETCONTENT parameter are
SendMessage(hWnd%, wMsg%, wParam%, lParam&)
where:
hWnd% Identifies the window that is to receive the message.
wMsg% The message to be sent. (&H405)
wParam% Is not used. (NULL)
lParam& Is not used. (NULL)
Specifying wMsg% equal to &H405 removes all strings from the list box
and frees any memory allocated for those strings.
To get hWnd% you must call the Windows API function GetFocus. This
method will return the handle to the control that currently has focus,
in this case the list box that you want to delete all items from.
The code listed below demonstrates how to delete entries from a list
box:
1. Create a list box called List1 on Form1.
2. Declare the following Windows API functions at the module level or
in the Global section of your code as follows:
Declare Function SendMessage% Lib "user" (ByVal hWnd%,_
ByVal wMsg%,_
ByVal wParam%,_
ByVal lParam&)
Declare Function GetFocus% Lib "user" ()
Declare Function PutFocus% Lib "user" Alias "SetFocus" (ByVal hWnd%)
Note: Each Declare statement must be written on one line, leaving
out the underscore (_) line-continuation symbol shown above.
3. Declare the following constants in the same section:
Const WM_USER = &H400
Const LB_RESETCONTENT = WM_USER + 5
4. Create a Sub within the (declarations) section of the code window
with the following code:
Sub ClearListBox (Ctrl As Control)
hWndOld% = GetFocus()
Ctrl.SetFocus
x = SendMessage(GetFocus(), LB_RESETCONTENT, 0, 0)
Suc% = PutFocus(hWndOld%)
End Sub
5. Now, within some event procedure, call ClearListBox with the name
of the list box as a parameter:
Sub Form_Click ()
ClearListBox List1
End Sub
6. Place some entries into the list box:
Sub Form_Load ()
For i = 1 To 10
List1.AddItem Format$(i) 'Put something into list box.
Next
End Sub
6. Run the program and click anywhere on Form1. This will clear out
the list box.

Knowledge Base

Title: How to Emulate QuickBasic's SOUND Statement in Visual Basic
Document Number: Q71102 Publ Date: 20-MAY-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
The SOUND statement found in Microsoft QuickBASIC is not implemented
within Microsoft Visual Basic. You can perform sound through a Windows
3.00 API call that is equivalent to the QuickBASIC SOUND statement.
This information applies to Microsoft Visual Basic Programming System
version 1.00 for Windows.
More Information:
The QuickBASIC version of the SOUND statement can be executed by
calling several Windows 3.00 API function calls. Within Windows, you
must open up a VoiceQueue with the OpenSound call routine. Using the
function SetVoiceSound, place all of the values corresponding to the
desired frequencies and durations. Once the VoiceQueue has the desired
frequencies and durations, you start the process by calling
StartSound. After the sounds have been played, you must free up the
VoiceQueue by calling CloseSound. If you plan on placing a large
amount of information into the VoiceQueue, you may need to resize the
VoiceQueue buffer by calling the SetVoiceQueueSize function.
After executing the StartSound function, you cannot place any more
sound into the VoiceQueue until the VoiceQueue is depleted. Placing
more sound into the queue will overwrite any information that was
previously in the VoiceQueue. If you are going to place sound into the
VoiceQueue after a StartSound statement, you will need to call
WaitSound with an argument of one. When WaitSound returns NULL, the
VoiceQueue is empty and processing can continue.
Below is an example of using the Windows API function calls, which will
imitate the QuickBASIC SOUND statement:
In the general section place the following:
Declare Function OpenSound Lib "sound.drv" () As Integer
Declare Function VoiceQueueSize Lib "sound.drv"
(ByVal nVoice%, ByVal nBytes%) As Integer
Declare Function SetVoiceSound Lib "sound.drv"
(ByVal nSource%, ByVal Freq&, ByVal nDuration%) As Integer
Declare Function StartSound Lib "sound.drv" () As Integer
Declare Function CloseSound Lib "sound.drv" () As Integer
Declare Function WaitSoundState Lib "sound.drv" (ByVal State%) As Integer
Note: All Declare statements above each must be placed on one line.
The SetVoiceSound takes two arguments. The first variable, Freq, is a
two WORD parameter. The HIGH WORD will hold the actual frequency in
hertz. The LOW WORD will hold the fractional frequency. The formula, X
* 2 ^ 16, will shift the variable "X" into the HIGH WORD location. The
second variable, Duration%, is the duration in clock ticks. There are
18.2 tick clicks per second on all Intel computers.
The following simplistic example shows how you can place several
frequencies and durations into the VoiceQueue before starting the
sound by calling the StartSound function:
Sub Form_Click ()
Suc% = OpenSound()
S% = SetVoiceSound(1, 100 * 2 ^ 16, 100) ' Frequency = 100hz
S% = SetVoiceSound(1, 90 * 2 ^ 16, 90) ' Frequency = 90 hz
S% = SetVoiceSound(1, 80 * 2 ^ 16, 90) ' Frequency = 80 hz
S% = StartSound()
Succ% = CloseSound()
End Sub
The following is another simple example, which creates a siren sound:
1. Within the general section, place the following Sound procedure:
Sub Sound (ByVal Freq as Long, ByVal Duration%)
Freq = Freq * 2 ^ 16 ' Shift frequency to high byte.
S% = SetVoiceSound(1, Freq, Duration%)
S% = StartSound()
While (WaitSoundState(1) <> 0): Wend
End Sub
2. Place the code below into any event procedure. The example below
uses the Form_Click event procedure. Clicking any position on the
form will create a police siren.
Sub Form_Click ()
Suc% = OpenSound()
For j& = 440 To 1000 Step 5
Call Sound(j&, j& / 100)
Next j&
For j& = 1000 To 440 Step -5
Call Sound(j&, j& / 100)
Next j&
Succ% = CloseSound()
End Sub

Knowledge Base

Title: How to Flood Fill in VB Using Windows API Function Call
Document Number: Q71103 Publ Date: 20-MAY-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
You can fill an area on a window in Visual Basic through a Windows API
function call. Depending on the type of fill to be performed, you can
use ExtFloodFill to achieve the desired effect.
This information applies to Microsoft Visual Basic Programming System
version 1.00 for Windows.
More Information:
The Windows API function call ExtFloodFill fills an area of the
display surface with the current brush, as shown in the example below.
Code Example
------------
From VB.EXE's Code menu, choose View Code, and enter the following
code (on just one line) for Form1 [using (general) from the Object
box, and (declarations) from the Procedure box|:
Declare Function ExtFloodFill Lib "GDI" (ByVal hdc%, ByVal i%,
ByVal i%, ByVal w&, ByVal i%) As Integer
To demonstrate several fill examples, create a picture box called
Picture1. Set the following properties:
AutoSize = TRUE ' Scale picture to size of imported picture.
FillColor = &HFF00FF ' This will be the selected fill color.
FillStyle = Solid ' Necessary to create a fill pattern.
Picture = Chess.bmp ' This should be in your Windows directory.
Create a push button in a location that will not be overlapped by
Picture1. Within the Click event, create the following code:
Sub Command1_Click ()
' Make sure that the FillStyle is not transparent.
' crColor& specifies the color for the boundary.
Const FLOODFILLBORDER = 0 ' Fill until crColor& color encountered.
Const FLOODFILLSURFACE = 1 ' Fill surface until crColor& color not
' encountered.
X% = 1
Y% = 1
crColor& = RGB(0, 0, 0)
wFillType% = FLOODFILLSURFACE
Suc% = ExtFloodFill(picture1.hDC, X%, Y%, crColor&, wFillType%)
End Sub
When you click on the push button, the black background will change to
the FillColor. The fill area is defined by the color specified by
crColor&. Filling continues outward from (X%,Y%) as long as the color
is encountered.
Now change the related code to represent the following:
crColor& = RGB(255, 0, 0) 'Color to look for.
wFillType% = FLOODFILLBORDER
Suc% = ExtFloodFill(picture1.hDC, X%, Y%, crColor&, wFillType%)
Executing the push button will now fill the area until crColor& is
encountered. In the first example, the fill was performed while the
color was encountered; in the second example, the fill was performed
while the color was NOT encountered. In the last example, everything
is changed except the "floating pawn".

Knowledge Base

Title: How to Use Windows 3.0 BitBlt Function from Visual Basic
Document Number: Q71104 Publ Date: 10-JUN-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
The Windows GDI.DLL has a function call BitBlt, which will move the
source device given by the hSrcDC parameter to the destination device
given by the hDestDC parameter. This article explains in detail the
arguments of the Windows BitBlt function call.
This information applies to Microsoft Visual Basic Programming System
version 1.00 for Windows.
More Information:
To use BitBlt within a Visual Basic application, you must Declare
the BitBlt function in either the Global section or within the
(declaration) section of your code window. Declare the Function as
follows:
Declare Function BitBlt Lib "gdi" (ByVal hDestDC%,
ByVal X%, ByVal Y%,
ByVal nWidth%,
ByVal nHeight%,
ByVal hSrcDC%,
ByVal XSrc%, ByVal YSrc%,
ByVal dwRop&) As Integer
Note: The above Declare statement must be written on just one line.
The following formal parameters are defined as:
Formal Parameter Definition
---------------- ----------
hDestDC Specifies the device context that is to
receive the bitmap.
X,Y Specifies the logical x-coordinate and
y-coordinate of the upper-left corner of the
destination rectangle.
nWidth, nHeight Specifies the width (in logical units) of the
destination rectangle and the source bitmap.
nHeight Specifies the height (in logical units) of
the destination rectangle and the source
bitmap.
hSrcDC Identifies the device context from which the
bitmap will be copied. It must be
NULL(zero) if the dwRop& parameter specifies
a raster operation that does not include a
source.
XSrc Specifies the logical x-coordinate and the
y-coordinate of the upper-left corner of the
source bitmap.
dwRop Specifies the raster operation to be performed
as defined below.
The following Raster operations are defined using the predefined
constants found in the WINDOWS.H file supplied with the Microsoft
Windows version 3.00 Software Development Kit (SDK). The value within
the "()" is the value to assign to the dwRop& variable.
Code/Value (hex) Description
---------------- -----------
BLACKNESS (42) Turn output black.
DSINVERT(550009) Inverts the destination bitmap.
MERGECOPY(C000CA) Combines the pattern and the source bitmap
using the Boolean AND operation.
MERGEPAINT(BB0226) Combines the inverted source bitmap with the
destination bitmap using the Boolean OR
operator.
NOTSRCCOPY(330008) Copies the inverted source bitmap to the
destination.
NOTSRCERASE(1100A6) Inverts the result of combining the
destination and source bitmap using the
Boolean OR operator.
PATCOPY(F00021) Copies the pattern to the destination bitmap.
PATINVERT(5A0049) Combines the destination bitmap with the
pattern using the Boolean XOR operator.
PATPAINT(FB0A09) Combines the inverted source bitmap with the
pattern using the Boolean OR operator.
Combines the result of this operation with
the destination bitmap using the Boolean OR
operator.
SRCAND(8800C6) Combines pixels of the destination and source
bitmap using the Boolean AND operator.
SRCCOPY(CC0020) Copies the source bitmap to the destination
bitmap.
SRCERASE(4400328) Inverts the destination bitmap and combines
the results with the source bitmap using the
Boolean AND operator.
SRCINVERT(660046) Combines pixels of the destination and source
bitmap using the Boolean XOR operator.
SRCPAINT(EE0086) Combines pixels of the destination and source
bitmap using the Boolean OR operator.
WHITENESS(FF0062) Turns all output white.
Below is an example of how to copy the contents of a picture control
to the contents of another picture control.
Define a form with two picture controls. Display some graphics on
Picture1 by loading from a picture file or pasting from the clipboard
at design time. You can load a picture from a file as follows: from
the Properties bar, select Picture from the Properties list box and
click the arrow at the right of the Settings box, then select the
desired picture file (such as a .BMP or .ICO file supplied with
Microsoft Windows) from the dialog box.
Add the following code to the Form_Click procedure. Run the program
and click the form. The contents of the first picture will be
displayed to the second picture.
Sub Form_Click ()
' Assign information of the destination bitmap. Note that Bitblt
' requires coordinates in pixels.
Const PIXEL = 3
Picture1.ScaleMode = PIXEL
Picture2.ScaleMode = PIXEL
hDestDC% = Picture2.hDC
X% = 0: Y% = 0
nWidth% = Picture2.ScaleWidth
nHeight% = Picture2.ScaleHeight
' Assign information of the source bitmap.
hSrcDC% = Picture1.hDC
XSrc% = 0: YSrc% = 0
' Assign the SRCCOPY constant to the Raster operation.
dwRop& = &HCC0020
Suc% = BitBlt(hDestDC%, X%, Y%, nWidth%, nHeight%,_
hSrcDC%, XSrc%, YSrc%, dwRop&)
End Sub

Knowledge Base

Title: How to Set Hourglass MousePointer in VB Program During Delays
Document Number: Q71105 Publ Date: 20-MAY-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: MS-DOS

Summary:
During operations that take time, you may decide to display the
hourglass mouse cursor. This will let the user know that the computer
is performing an operation that may take some noticeable time, and
that no user input will be immediately processed during this time.
This information applies to Microsoft Visual Basic Programming System
version 1.00 for Windows.
More Information:
The MousePointer property can be set during design time or during run
time. During operations that may take some noticeable amount of time,
the MousePointer should be set to the hourglass pointer. This can be
performed using the Screen.MousePointer property. Before setting the
mouse pointer to the hourglass, you should save the present mouse
pointer so that when you are through with the hourglass cursor, you
can re-initialize it to the previous pointer. Below is an example of
setting the pointer to the hourglass cursor:
Sub Form_Click ()
SavedPointer = Screen.MousePointer ' Save mouse pointer.
Screen.MousePointer = 11 ' 11# = hourglass.
For i = 1 To 10000: Next i ' Some lengthy operation.
Screen.MousePointer = SavedPointer ' set to previous mouse pointer.
End Sub

Knowledge Base

Title: How to Pass One-Byte Parameters from VB to DLL Routines
Document Number: Q71106 Publ Date: 20-MAY-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
Calling some routines in dynamic link libraries (DLLs) requires BYTE
parameters in the argument list. Visual Basic possesses no BYTE data
type as defined in other languages such as C, which can create DLLs.
To pass a BYTE value correctly to an external FUNCTION (in a DLL),
which requires a BYTE data type, you must pass an integer data type
for the BYTE parameter.
This information applies to Microsoft Visual Basic Programming System
version 1.00 for Windows.
More Information:
Visual BASIC has the ability to call external code in the form of
dynamic link libraries (DLLs). Some of these libraries require BYTE
parameters in the argument list. An example of this is located in the
KEYBOARD.DRV FUNCTION as defined below:
FUNCTION GetTempFileName (BYTE cDrive,
LPSTR lpPrefix,
WORD wUnique,
LPSTR lpTempFileName)
GetTempFileName is documented on page 4-217 of the "Microsoft Windows
3.0 Software Development Kit, Reference - Volume 1." In Visual BASIC,
declare the FUNCTION on one line in the main module of your code:
DECLARE FUNCTION GetTempFileName LIB "keyboard.drv"
(BYVAL A%, BYVAL B$, BYVAL C%, BYVAL D$)
Because the architecture of the 80x86 stack is segmented into word
boundaries, the smallest type pushed onto the stack will be a word.
Therefore, both the BYTE and the integer will be pushed onto the stack
in the same manner, and require the same amount of memory. This is the
reason you can use an integer data type for a BYTE data type in these
types of procedure calls.

Knowledge Base

Title: How to Send an HBITMAP to Windows API Function Calls from VB
Document Number: Q71260 Publ Date: 20-MAY-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
Several Windows API functions require the HBITMAP data type. Visual
Basic does not have a HBITMAP data type. This article explains how to
send the equivalent Visual Basic HBITMAP handle of a picture control
to a Windows API function call.
This information applies to Microsoft Visual Basic Programming System
version 1.00 for Windows.
More Information:
The HBITMAP data type represents a 16-bit index to GDIs physical
drawing object. Several Windows API routines need the HBITMAP data
type as an argument. Sending the [picture-control|.Picture as an
argument is the equivalent in Visual Basic.
The code sample below demonstrates how to send HBITMAP to the Windows
API function ModifyMenu.
Declare Function SetMenuItemBitMaps% Lib "user" (ByVal hMenu%,
ByVal nPos%,
ByVal wFlag%,
ByVal BitmapUnChecked%,
ByVal hBitmapChecked%)
Note: The above Declare statement must be written on just one line.
The SetMenuItemBitMap takes five arguments. The fourth and fifth
arguments are HBITMAP data types.
The following code segment will associate the specified bitmap
Picture1.Picture in place of the default check mark:
X% = SetMenuItemBitMap(hMenu%, menuID%,0,0, Picture1.Picture)
Reference:
1. "Programming Windows: the Microsoft Guide to Writing Applications
for Windows 3," by Charles Petzold (published by Microsoft
Press, 1990)
2. "Microsoft Windows 3.0 Software Development Kit: Reference
Volume 1"
3. The WINSDK.HLP file shipped with Microsoft Windows 3.0 Software
Development Kit.

Knowledge Base

Title: How to Create Pop-up Menus on a Visual Basic Form
Document Number: Q71279 Publ Date: 20-MAY-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
Visual Basic can call the Windows API function TrackPopupMenu to
display a specified menu at the location on the screen that the user
clicks with the mouse.
This information applies to Microsoft Visual Basic Programming
System version 1.00 for Windows.
More Information:
The TrackPopupMenu function displays a "floating" pop-up menu at the
specified location and tracks the selection of items on the pop-up
menu. A floating pop-up menu can appear anywhere on the screen. The
hMenu parameter specifies the handle of the menu to be displayed; the
application obtains this handle by calling GetSubMenu to retrieve the
handle of a pop-up menu associated with an existing menu item.
TrackPopupMenu is defined as follows
TrackPopupMenu (hMenu%,wFlags%, X%, Y%, rRes%, hwnd%, lpRes&)
where:
hMenu% - Identifies the pop-up menu to be displayed.
wFlags% - Not used. This parameter must be set to zero.
x% - Specifies the horizontal position in screen coordinates
of the left side of the menu on the screen.
y% - Specifies the vertical position in screen coordinates
of the top of the menu on the screen.
nRes% - Is reserved and must be set to zero.
hWnd% - Identifies the window that owns the pop-up menu.
lpRes& - Is reserved and must be set to NULL.
The supporting Windows API functions needed to support the arguments
to TrackPopupMenu are:
1. GetMenu(hWnd%)
hWnd% - Identifies the window whose menu is to be examined.
GetMenu returns a value that identifies the menu. The return value
is NULL if the given window has no menu. The return value is
undefined if the window is a child window.
2. GetSubMenu(hMenu%, nPos%)
hMenu% - Identifies the menu.
nPos% - Specifies the position in the given menu of the pop-up
menu. Position values start at zero for the first
menu item.
GetSubMenu returns a value that identifies the given pop-up menu.
The return value is NULL if no pop-up menu exists at the given
position.
To create a pop-up menu within Visual Basic, define a menu system with
the Menu Design window. The following is an example of a menu system:
Caption CntlName Indented
------- -------- --------
File M_File No
New M_New Once
Open M_Open Once
Close M_Close Once
Exit M_Exit Once
Help M_Help No
Within the general-declaration section of your Code window, declare
the following:
Declare Function TrackPopupMenu% Lib "user"(ByVal hMenu%,
ByVal wFlags%,
ByVal X%, ByVal Y%,
ByVal r2%, ByVal hwnd%,
ByVal r1&)
Declare Function GetMenu% Lib "user" (ByVal hwnd%)
Declare Function GetSubMenu% Lib "user" (ByVal hMenu%, ByVal nPos%)
Note: Each Declare statement above must be located on just one line.
Place the following code in the form's MouseUp event procedure:
Sub Form1_MouseUp (Button As Integer, Shift As Integer, X As Single,
Y As Single)
' The above Sub statement must be concatenated onto one line.
Const PIXEL = 3
Const TWIP = 1
ScaleMode = PIXEL
InPixels = ScaleWidth
ScaleMode = TWIP
IX = (X + Left) \ (ScaleWidth \ InPixels)
IY = (Y + (Top + (Height - ScaleHeight -
(Width - ScaleWidth)))) \ (ScaleWidth \ InPixels)
' The above IY = ... statement must be concatenated onto one line.
hMenu% = GetMenu(hwnd)
hSubMenu% = GetSubMenu(hMenu%, Button - 1)
R = TrackPopupMenu(hSubMenu%, 0, IX, IY, 0, hwnd, 0)
End Sub
When you run the program, clicking anywhere on Form1 will display the
first menu on your menu bar at that location.
Reference:
1. "Programming Windows: the Microsoft Guide to Writing Applications
for Windows 3," by Charles Petzold (published by Microsoft
Press, 1990)
2. "Microsoft Windows 3.0 Software Development Kit: Reference
Volume 1"
3. The WINSDK.HLP file shipped with Microsoft Windows 3.0 Software
Development Kit.

Knowledge Base

Title: How to Create a Flashing Title Bar on a Visual Basic Form
Document Number: Q71280 Publ Date: 20-MAY-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
When calling a Windows API function call, you can create a flashing
window title bar on the present form or any other form for which you
know the handle.
This information applies to Microsoft Visual Basic Programming System
version 1.00 for Windows.
More Information:
Visual Basic has the ability to flash the title bar on any other form
if you can get the handle to that form. The function FlashWindow
flashes the specified window once. Flashing a window means changing
the appearance of its caption bar, as if the window were changing from
inactive to active status, or vice versa. (An inactive caption bar
changes to an active caption bar; an active caption bar changes to an
inactive caption bar.)
Typically, a window is flashed to inform the user that the window
requires attention when that window does not currently have the input
focus.
The function FlashWindow is defined as
FlashWindow(hWnd%, bInvert%)
where:
hWnd% - Identifies the window to be flashed. The window can be
either open or iconic.
bInvert% - Specifies whether the window is to be flashed or
returned to its original state. The window is flashed
from one state to the other if the bInvert parameter is
nonzero. If the bInvert parameter is zero, the window
is returned to its original state (either active or
inactive).
FlashWindow returns a value that specifies the window's state before
the call to the FlashWindow function. It is nonzero if the window was
active before the call; otherwise, it is zero.
The following section describes how to flash a form while that form
does not have the focus:
1. Create two forms called Form1 and Form2.
2. On Form1, create a timer control and set the Interval Property to
1000. Also set the Enabled Property to FALSE.
3. Within the general-declarations section of Form1, declare the
FlashWindow function as follows:
Declare Function FlashWindow% Lib "user" (ByVal hWnd%,
ByVal bInvert%)
4. Define the following constants directly after the declarations
section:
Const TRUE = -1
Const FALSE = 0
5. In the Form_Load event procedure, add the following code:
Sub Form_Load ()
Form2.Show
End Sub
6. In the Sub_Time1_Timer () procedure of Form1, add the following
code:
Sub Timer1_Timer ()
Succ% = FlashWindow(Form1.hWnd, 1)
End Sub
7. In the GetFocus event procedure of Form1, create the following
code:
Sub Form_GotFocus ()
Timer1.Enabled = 0
End Sub
8. In the Click event for Form2, add the following code:
Sub Form_Click ()
Form1.Timer1.Enabled = -1
End Sub
9. Run the program. Form1 will be in the foreground with Form2 in the
background. Click anywhere on Form2; Form1's Caption Bar will flash
until you click on Form1.
Reference:
1. "Programming Windows: the Microsoft Guide to Writing Applications
for Windows 3," by Charles Petzold (published by Microsoft
Press, 1990)
2. "Microsoft Windows 3.0 Software Development Kit: Reference
Volume 1"
3. The WINSDK.HLP file shipped with Microsoft Windows 3.0 Software
Development Kit.

Knowledge Base

Title: How to Implement Bitmaps Within Visual Basic Menus
Document Number: Q71281 Publ Date: 20-MAY-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
There is no command within Visual Basic that will add bitmaps to the
menu system. There are several Windows API functions that you can call
that will place bitmaps within the menu system. You may also change
the default check mark displayed.
This information applies to Microsoft Visual Basic Programming System
version 1.00 for Windows.
More Information:
There are several Windows API functions that you can call that will
display bitmaps instead of text in the menu system.
Below is a list of the required Windows API functions:
1. GetMenu% (hwnd%)
hwnd% - Identifies the window whose menu is to be examined.
Returns: Handle to the menu.
2. GetSubMenu% (hMenu%, nPos%)
hMenu% - Identifies the menu.
nPos% - Specifies the position (zero-based) in the given menu of
the pop-up menu.
Returns: Handle to the given pop-up menu.
3. GetMenuItemID% (hMenu%, nPos%)
hMenu% - Identifies the handle to the pop-up menu that contains
the item whose ID is being retrieved.
nPos - Specifies the position(zero-based) of the menu whose ID
is being retrieved.
Returns: The item ID for the specified item in the pop-up menu.
4. ModifyMenu% (hMenu%, nPos%, wFlags%, wIDNewItem%, lpNewItem&)
hMenu% - Identifies the handle to the pop-up menu that contains
the item whose ID is being retrieved.
nPos% - Specifies the menu item to be changed. The
interpretation of the nPos parameter depends on the
wFlags parameter.
wFlags% - BF_BITMAP = &H4
wIDNewItem% - Specifies the command ID of the modified menu item.
lpNewItem& - 32-bit handle to the bitmap.
Returns: TRUE if successful, FALSE if unsuccessful.
5. SetMenuItemBitmaps% (hMenu%, nPos%, wFlags%,hBitmapUnchecked%,
hBitmapChecked%)
hMenu% - Identifies menu to be changed.
nPos% - Command ID of the menu item
wFlags% - &H0
hBitmapUnchecked% - Handle to "unchecked" bitmap.
hBitmapChecked%) - Handle to the "check" bitmap.
Returns: TRUE if successful, FALSE if unsuccessful.
There are two different ways to implement bitmaps within Visual Basic.
The first method is using static bitmaps. The other method is using
dynamic bitmaps.
Static bitmaps are bitmaps that are placed within the menu using
static bitmaps. Dynamic bitmaps are bitmaps that are changed during
execution of your program. You may change dynamic bitmap attributes
such as color, size, and text. The sample code below describes how to
perform both types of menus.
Define a menu system using the Menu Design window. Create a menu
system such as the following:
Caption CtlName Indented Index
------- ------- -------- -----
BitMenu TopMenu No
Sub Menu0 SubMenu Once 0
Sub Menu1 SubMenu Once 1
Sub Menu2 SubMenu Once 2
Create a Picture Control Array with 3 bitmaps. This can be
accomplished by creating 3 picture controls with the same CtlName
using the Properties list box.
Caption CtlName Index FontSize
------- ------- ----- --------
Picture0 Picture1 0 Set different
Picture1 Picture1 1 font sizes for
Picture2 Picture1 2 each of the pictures
Both types of bitmap implementations will need to have the following
declarations in the declaration or global section of your code:
Declare Function GetMenu% Lib "user" (ByVal hwnd%)
Declare Function GetSubMenu% Lib "user" (ByVal hMenu%, ByVal nPos%)
Declare Function GetMenuItemID% Lib "user" (ByVal hMenu%, ByVal,
nPos%)
Declare Function ModifyMenu% Lib "user" (ByVal hMenu%,
ByVal nPosition%, ByVal wFlags%,
ByVal wIDNewItem%, ByVal lpNewItem&)
Declare Function SetMenuItemBitmaps% Lib "user" (ByVal hMenu%,
ByVal nPosition%, ByVal wFlags%,
ByVal hBitmapUnchecked%, ByVal BitmapChecked%)
' NOTE: Each Declare statement above must be on just one line.
Const MF_BITMAP = &H4
Const CLR_MENUBAR = &H80000004 ' Defined for dynamic bitmaps only.
Const TRUE = -1, FALSE = 0
Const Number_of_Menu_Selections = 3
The following Sub will also need to be defined to handle the actual
redefinition of the "check" bitmap:
Sub SubMenu_Click (Index As Integer)
' Uncheck presently checked item, check new item, store index
Static LastSelection%
SubMenu(LastSelection%).Checked = FALSE
SubMenu(Index).Checked = TRUE
LastSelection% = Index
End Sub
The following examples show the two ways to implement the Dynamic and
Static menu bitmaps.
Static Bitmap Menus
-------------------
Add the code listed below to the appropriate Sub:
Sub Form_Load ()
' Get the handle to the top level Menu
hMenu% = GetMenu(hwnd)
' Get the handle to the SubMenu of top level Menu
hSubMenu% = GetSubMenu(hMenu%, 0)
For I% = 0 To Number_of_Menu_Selections - 1
' get the handle to the specific item in SubMenu
menuID% = GetMenuItemID(hSubMenu%, I%)
' Place the bitmap into the I'th submenu location
X% = ModifyMenu(hMenu%, menuID%, MF_BITMAP, menuID%,
CLng(picture1(I%).Picture))
' Assign bitmap for the check mark to the I'th submenu
X% = SetMenuItemBitmaps(hMenu%, menuID%, 0, 0,
CLng(picture2.Picture))
Next I%
End Sub
Dynamic Bitmap Menus
--------------------
This code sample will change the actual menu bitmaps size, font size,
color, and caption. Run the application and select the BitMenu and
view the selections. Then click on the form and revisit the BitMenu.
Sub Form_Click ()
For i% = 0 To Number_of_Menu_Selections
'* Place some text into the menu.
SubMenu(i%).Caption = Picture1(i%).FontName +
Str$(Picture1(i%).FontSize) + " Pnt"
'* 1. Must be AutoRedraw for Image().
'* 2. Set Backcolor of Picture control to that of the
'* current system Menu Bar color, so Dynamic bitmaps
'* will appear as normal menu items when menu bar
'* color is changed via the control panel
'* 3. See the bitmaps on screen, this could all be done at design
'* time.
Picture1(i%).AutoRedraw = TRUE
Picture1(i%).BackColor = CLR_MENUBAR
Picture1(i%).Visible = FALSE
'* Set the width and height of the Picture controls
'* based on their corresponding Menu items caption,
'* and the Picture controls Font and FontSize.
'* DoEvents() is necessary to make new dimension
'* values to take affect prior to exiting this Sub.
Picture1(i%).Width = Picture1(i%).TextWidth(SubMenu(i%).Caption)
Picture1(i%).Height =Picture1(i%).TextHeight(SubMenu(i%).Caption)
Picture1(i%).Print SubMenu(i%).Caption
'* - Set picture controls backgroup picture (Bitmap) to its Image.
Picture1(i%).Picture = Picture1(i%).Image
X% = DoEvents()
Next i%
'* Get handle to forms menu.
hMenu% = GetMenu(Form1.hwnd)
'* Get handle to the specific menu in top level menu.
hSubMenu% = GetSubMenu(hMenu%, 0)
For i% = 0 To Number_of_Menu_Selections
'* Get ID of sub menu
menuID% = GetMenuItemID(hSubMenu%, i%)
'* Replace menu text w/bitmap from corresponding picture control
X% = ModifyMenu(hMenu%, menuID%, MF_BITMAP, menuID%,
CLng(Picture1(i%).Picture))
'* Replace bitmap for menu check mark with custom check bitmap
X% = SetMenuItemBitmaps(hMenu%, menuID%, 0, 0,
CLng(picture2.Picture))
Next i%
End Sub

Knowledge Base

Title: How to Create Rubber-Band Lines/Boxes in Visual Basic
Document Number: Q71488 Publ Date: 20-MAY-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
Creating rubber bands within Visual Basic can be done using the
DrawMode property. Rubber bands are lines that stretch as you move the
mouse cursor from a specified point to a new location. This can be
very useful in graphics programs and when defining sections of the
screen for clipping routines.
This information applies to Microsoft Visual Basic Programming System
version 1.00 for Windows.
More Information:
The theory of drawing a rubber-band box is as follows:
1. Draw a line from the initial point to the location of the mouse
cursor using:
[form|.DrawMode = 6. {INVERT}
2. Move the mouse cursor.
3. Save the DrawMode.
4. Set the [form|.DrawMode to 6. {INVERT}
5. Draw the same line that was drawn in step 1. This will restore the
image underneath the line.
6. Set the [form|.DrawMode back to the initial DrawMode saved in step
3.
7. Repeat the cycle again.
DrawMode equal to INVERT allows the line to be created using the
inverse of the background color. This allows the line to be always
displayed on all colors.
The sample below will demonstrate the rubber-band line and the
rubber-band box. Clicking on the command buttons will allow the user
to select between rubber-band line or a rubber-band box. The user will
also be able to select a solid line or a dashed line.
Create and set the following controls and properties:
CtlName Caption Picture
------- ------- -------
Form1 Form1 c:\windows\chess.bmp
Command1 RubberBand
Command2 RubberBox
Command3 Dotted
Command4 Solid
In the general section of your code, define the following constants:
Const INVERSE = 6 '*Characteristic of DrawMode property(XOR).
Const SOLID = 0 '*Characteristic of DrawStyle property.
Const DOT = 2 '*Characteristic of DrawStyle property.
Const TRUE = -1
Const FALSE = 0
Dim DrawBox As Integer '*Boolean-whether drawing Box or Line
Dim OldX, OldY, StartX, StartY As Single '* Mouse locations
In the appropriate procedures, add the following code:
Sub Form_MouseDown (Button As Integer, Shift As Integer, X As
Single, Y As Single)
'* Store the initial start of the line to draw.
StartX = X
StartY = Y
'* Make the last location equal the starting location
OldX = StartX
OldY = StartY
End Sub
Sub Form_MouseMove (Button As Integer, Shift As Integer, X As
Single, Y As Single)
'* If the button is depressed then...
If Button Then
'* Erase the previous line.
Call DrawLine(StartX, StartY, OldX, OldY)
'* Draw the new line.
Call DrawLine(StartX, StartY, X, Y)
'* Save the coordinates for the next call.
OldX = X
OldY = Y
End If
End Sub
Sub DrawLine (X1, Y1, X2, Y2 As Single)
'* Save the current mode so that you can reset it on
'* exit from this sub routine. Not needed in the sample
'* but would need it if you are not sure what the
'* DrawMode was on entry to this procedure.
SavedMode% = DrawMode
'* Set to XOR
DrawMode = INVERSE
'*Draw a box or line
If DrawBox Then
Line (X1, Y1)-(X2, Y2), , B
Else
Line (X1, Y1)-(X2, Y2)
End If
'* Reset the DrawMode
DrawMode = SavedMode%
End Sub
Sub Form_MouseUp (Button As Integer, Shift As Integer, X As Single,
Y As Single)
'* Stop drawing lines/boxes.
StartEvent = FALSE
End Sub
Sub Command2_Click ()
'* Boolean value to determine whether to draw a line or box.
DrawBox = TRUE
End Sub
Sub Command1_Click ()
'* Boolean value to determine whether to draw a line or box.
DrawBox = FALSE
End Sub
Sub Command3_Click ()
'* Create a dotted line
Form1.DrawStyle = DOT
End Sub
Sub Command4_Click ()
'* Create a solid line.
Form1.DrawStyle = SOLID
End Sub

Knowledge Base

Title: Visual Basic Support Service Letter, BL0356; Phone Policies
Document Number: Q72264 Publ Date: 30-MAY-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
Below is the letter that Microsoft sends in response to customers who
want to know what Microsoft support services are available for Visual
Basic.
This form letter is sent out from Microsoft Product Support Services
(PSS) as the following application note:
BL0356 "Visual Basic Support Service Letter"
This information applies to Microsoft Visual Basic version 1.00
programming system for Windows.
More Information:
Note: Page 1 of 2 is shown below for this reply letter. Page 2 of 2,
the "Product Assistance Checklist," is shown in a separate article
found by querying using the following words:
product and assistance and checklist
BL0356 "Visual Basic Support Service Letter"
---------------------------------------------
Dear Visual Basic Customer:
Thank you for contacting us regarding Microsoft Visual Basic
Programming System for Windows. Although we are unable to respond to
technical questions by letter (unless solicited by Microsoft), we will
forward your questions to our development team. This procedure
provides developers with customer feedback, which will make
Microsoft's products even better. For fast answers to your technical
questions, you may contact Microsoft directly using the following
support services:
1. Microsoft Visual Basic startup service: (206) 646-5105
8 AM to 5 PM Pacific Time, Monday - Friday (except holidays)
Microsoft is committed to getting you "up and running" with Visual
Basic. On this phone line, a technician will assist you with setup
and installation questions, and provide information on system
requirements, product functionality, and navigating the Visual
Basic environment. Product suggestions and problem reports are
also welcome on this line. This service is free (but normal long-
distance charges are billed by your phone company).
2. Microsoft OnCall(TM) for Visual Basic:
(900) 896-9876 or (206) 646-5106
Extended hours: 6 AM to 6 PM Pacific Time, Monday - Friday (except
holidays)
For "how-to" programming assistance, priority support is available
through this fee-based service. At OnCall for Visual Basic,
technicians will answer questions about writing and debugging code,
fine-tuning programs, error trapping and handling, creating custom
controls, and calling the Windows API from Visual Basic. The rate
for OnCall service is $2 per minute at (900) 896-9876 (billed by
your phone company).
If you are blocked from dialing our 900 phone number, please call
(206) 646-5106, where we charge a credit card fee of $20 per call.
Only Master Card, VISA, and American Express credit cards are
accepted.
3. Microsoft AutoAnswer for Visual Basic: (206) 646-5107
Available 24 hours a day, 7 days a week
The AutoAnswer automated voice system provides prerecorded answers
to the most commonly asked questions about Visual Basic.
AutoAnswer also provides a voice mail system that allows you to
leave a message with comments on Visual Basic or on Microsoft
Product Support Services. The AutoAnswer service is free (but
normal long-distance charges are billed by your phone company).
The AutoAnswer system is updated periodically.
4. CompuServe Information Service: VBasic Forum, and the Microsoft
Knowledge Base
User feedback and Microsoft technical support are available on the
Microsoft Forum on CompuServe Information Service (CIS), an
independent electronic information service that provides a medium
for public discussion of Microsoft products. CompuServe also
provides access to the Microsoft Knowledge Base, which contains
descriptions of known problems and answers to commonly asked
questions. For additional information about CompuServe, please
call (800) 848-8990.
5. For more information on other comprehensive fee-based technical
support options available from Microsoft, call (800) 443-4672.
Thank you for using Microsoft Visual Basic,
Blain Barton
Basic Languages Team Manager
Microsoft Product Support Services BL0356, 5/20/91

Knowledge Base

Title: Declare Currency Type to Be Double When Returning from DLL
Document Number: Q72274 Publ Date: 30-MAY-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
When using Visual Basic, if you want to pass a parameter to a DLL
routine, or receive a function return value of type Currency from a
DLL routine written in Microsoft C, the parameter or function returned
should be declared as a "double" in the C routine.
Note that C does not support the Basic Currency data type, and
although specifying the parameter as type "double" in C will allow it
to be passed correctly, you will have to write your own C routines to
manipulate the data in the Currency variable. For information on the
internal format of the Currency data type, query using the following
words:
Basic and Currency and internal and format
This information applies to the Microsoft Visual Basic programming
system version 1.00 for Windows.
More Information:
When creating a DLL function that either receives or returns a
Currency data type, it may be useful to include the following
declaration:
typedef double currency;
Based on this typedef, a sample DLL routine to return a currency value
might be declared as follows:
currency FAR pascal foo(...);

Knowledge Base

Title: PR Microsoft Announces Visual Basic at Windows World '91
Document Number: Q72312 Publ Date: 22-MAY-1991
Product Name: Microsoft News Releases
Product Version:
Operating System:

Microsoft Announces Visual Basic at Windows World '91
General-Purpose, High-Productivity
Programming System for Microsoft Windows
ATLANTA -- May 20, 1991 -- Microsoft today announced Microsoft(R)
Visual Basic(TM) programming system at the Windows World '91 industry
trade show. Visual Basic is a graphical application development system
for Microsoft Windows(TM) graphical environment version 3.0 that
combines visual design tools with a powerful, general-purpose
programming language and Windows .EXE compiler. It provides a simple
solution to the complex task of creating real Windows-based software
applications.
"We set out to create the fastest, easiest way to program for the
Windows environment," said Bill Gates, Microsoft founder and CEO. "My
goal from the start was to make developing Windows applications as
easy and natural as possible. We also wanted this tool to appeal to a
broad spectrum of people interested in programming for Windows -- from
professional corporate programmers and consultants solving business
problems to independent software vendors and casual programmers."
Visual Basic programming system combines a rich, event-driven
programming model with the world's most widely used programming
language in a tightly integrated package. General development for the
Windows environment is faster than ever. The Visual Basic programming
system provides visual user-interface design capabilities with
powerful general-purpose programming tools, making it easy for any
programmer to create compiled Windows .EXE files that can be freely
distributed without run-time fees or royalties of any kind.
"This is the most important software product of the year, if not the
decade," said Steve Gibson, president of Gibson Research Inc. "It's
the ultimate intellectual tool. Thanks to Visual Basic, both casual
and professional programmers can produce compelling and beautiful
results. Now it's easy to put together real Windows version 3.0
applications."
"We needed to create an application that incorporated Microsoft Word
for Windows and Microsoft Excel," said Craig Ellis, senior programmer
analyst, Reuters Information Systems. "Visual Basic was the tool to do
this. It filled our needs, allowed us to develop a fast and effective
application and cut our development time by more than half. It's a
fantastic product that allowed us to incorporate a family of Microsoft
products into one application."
The Visual Basic programming system can be used to develop any
Windows-based application, including corporate business systems, tools
and utilities, front ends to data (mainframe, server and local) or
commercial Windows software products. It is also useful for
integrating multiple Windows-based applications and for automating
software testing through dynamic data exchange (DDE).
Visual Basic programming system provides visual design tools for
creating the user interface components -- windows and dialogs -- of an
application. A full set of Windows interface components (including
command buttons, text fields, list boxes, pictures, drop-down menus
and file system controls) are created visually, without writing any
code. The forms engine for building the interface incorporates
technology acquired from Cooper Software. A powerful, structured
programming language is then used to add functionality to these
interface components, responding to events that are automatically
trapped by the system.
The Visual Basic language is a derivative of the Microsoft
QuickBasic(TM) modern programming system, modified for the graphical
environment and the event-driven programming language. It uses a
threaded p-code incremental compiler and source-level debugging tools,
including an interactive immediate window, in a tightly integrated
system.
Extensibility
-------------
Support is provided for DDE, the mechanism for exchanging data with
other Windows-based applications. The Visual Basic system also
supports dynamic link libraries (DLLs), which allow the user to
establish links with other Windows systems facilities and call the
Windows API or routines written in other languages and compiled into
DLLs. The control set itself can be extended by developers using C and
the Windows SDK and the Microsoft Visual Basic Control Development
Kit, available separately. This extensibility will provide the ability
to fully integrate new user interface components into the graphical
design and code development environment. Examples could include
multimedia, pen controls and data access.
Printed documentation and online Help provide step-by-step
instructions for writing programs. The online Help system provides
context-sensitive reference information and sample code that can be
copied and pasted into a Visual Basic program. An icon library of
approximately 400 designs and an icon editor written in Visual Basic
language are also included. "The built-in help is excellent," said Lee
Perryman, deputy director of Associated Press Broadcast Services in
Washington, D.C. "The debugging features are superb, and the controls
are rich and feature-packed. Because there is almost no learning curve
for users familiar with the Basic language, Visual Basic makes Windows
programming a snap."
Visual Basic programming system for Windows will be available in June
1991 for a suggested retail price* of $199. German and French versions
are expected to ship in August, with other foreign language versions
to follow.
The Visual Basic programming system runs in either the standard or
enhanced mode of Microsoft Windows graphical environment version 3.0
or higher. The system requirements include a personal computer using
80286 processor or higher; hard disk; mouse; CGA, EGA, VGA, 8514,
Hercules(R) or compatible display; MS-DOS(R) operating system version
3.1 or later and one or more megabyte of memory.
Microsoft Corporation (NASDAQ "MSFT") develops, markets and supports a
wide range of software for business and professional use, including
operating systems, network products, languages and applications as
well as books, CD-ROM products and hardware for the microcomputer
marketplace.
*Prices listed are U.S. suggested retail prices.
###
Microsoft, the Microsoft logo and MS-DOS are registered trademarks and
Microsoft QuickBasic, Visual Basic and Windows are trademarks of
Microsoft Corporation.
Hercules is a registered trademark of Hercules Computer Technology.
For pricing and availability outside the U.S., please contact your
local subsidiary.

Knowledge Base

Title: PR MS Announces Visual Basic Control Development Kit
Document Number: Q72313 Publ Date: 22-MAY-1991
Product Name: Microsoft News Releases
Product Version:
Operating System:

Control Development Kit Lets Developers
Extend Microsoft Visual Basic with New Controls
Redmond, Wash. -- May 20, 1991 -- Microsoft today announced the
Microsoft(R) Visual Basic(TM) Control Development Kit, a kit that
allows software developers to extend the capabilities of the Visual
Basic programming system by developing custom controls for the Visual
Basic Toolbox. Visual Basic is a general-purpose programming system
hosted within the Microsoft Windows(TM) graphical environment that
lets programmers quickly develop new applications for that
environment.
Custom controls created with the Control Development Kit can provide
new visual interface elements, trap events and add functionality --
just like the built-in controls that come with the product. Once the
custom controls are loaded into a project, they are available for use
along with the standard controls.
Standard Toolbox controls include such items as command buttons,
option buttons, text boxes, check boxes, scroll bars, timers and file
system controls. Possible custom controls that third parties could
develop with the Control Development Kit include controls for data
access, multimedia environments, and Microsoft Windows for Pen
Computing. For example, they might develop custom SQL Server controls
that trap messages from the server; animation, video and sound
controls for multimedia PCs; and controls for handwriting input and
recognition for the Windows for Pen environment. Custom controls are
written in C; developers using the Control Development Kit must also
be familiar with the Windows application programming interface (API).
"Visual Basic will make Windows programming much more accessible,
allowing millions of programmers to create their own Windows
programs," said Tom Button, product marketing manager for the
Microsoft applications programmability group. "Now, with the Control
Development Kit, third-party software developers can participate in
and help define this new opportunity. Visual Basic programmers will
also benefit from the development of custom controls, since these
controls will provide more options for application development."
Beta sites for the Control Development Kit are also enthusiastic about
the product. "I think Visual Basic is going to be a very successful
product -- and a key factor in its success is the fact that it's so
incredibly extensible," said Daniel Appleman, president of Desaware, a
software company based in San Jose, California. "With the standard
product, you get a set of built-in controls that are very useful; with
the Control Development Kit, you get the ability to add virtually any
control you want. And, once they've been added, the custom controls
are just as easy to use as the built-in ones."
The Visual Basic Control Development Kit includes 5.25- and 3.5-inch
disks, plus documentation. It requires the Visual Basic programming
system, the Microsoft Windows Software Development Kit (version 3.0 or
later) and the Microsoft C compiler (version 6.0 or later). The kit
will be available from Microsoft in June for $49.95* plus shipping,
handling and applicable sales tax.
Microsoft Corporation (NASDAQ "MSFT") develops, markets and supports a
wide range of software for business and professional use, including
operating systems, network products, languages and applications as
well as books, CD-ROM products and hardware for the microcomputer
marketplace.
*Prices listed are U.S. suggested retail prices.
###
Microsoft and the Microsoft logo are registered trademarks and Visual
Basic and Windows are trademarks of Microsoft Corporation.
For pricing and availability outside the U.S., please contact your
local subsidiary.

Knowledge Base

Title: PR Windows-Based Visual Basic SDK for SQL Server Announced
Document Number: Q72315 Publ Date: 22-MAY-1991
Product Name: Microsoft News Releases
Product Version:
Operating System:

Microsoft Announces Windows-Based Visual
Basic Software Development Kit for SQL Server
ATLANTA -- May 20, 1991 -- Microsoft Corporation today announced
Visual Basic(TM) Library and Software Development Kit (SDK) for
Microsoft(R) SQL Server. Visual Basic programmers can quickly develop
rich Microsoft Windows(TM) graphical environment-based client-server
applications for Microsoft SQL Server, the company's intelligent
database server for PC networks.
Developers wanting to take advantage of the Microsoft Windows
graphical environment and Microsoft SQL Server can now use the Visual
Basic SDK to build line-of-business or decision support applications
that require a robust multiuser database server. Developers can also
use Visual Basic Library for SQL Server with the Database Gateway(TM)
from Micro Decisionware, Boulder, Colo., to build graphical
applications that tap DB2(TM) and other IBM(R) mainframe data sources.
"Visual Basic programming system is an exciting tool for building rich
Windows-based client-server applications on SQL Server," said Dwayne
Walker, group business manager, server applications group at
Microsoft. "For some time now, our customers have been asking for such
a tool to develop prototypes and custom applications around SQL
Server."
Visual Basic Library for SQL Server is built on the standard SQL
Server application programming interface (API) called DB-Library(TM).
To date, Microsoft has provided language support for C, Basic, and
COBOL. Visual Basic Library for SQL Server adds another language to
the list of those that can be used to develop applications for SQL
Server.
Visual Basic Library for SQL Server will be available as a Software
Development Kit by June 30, 1991. The product will contain the
programming libraries, a preliminary documentation set and a copy of
Visual Basic programming system. It will be available directly from
Microsoft for $495*.
The Visual Basic system is a graphical application development system
for Microsoft Windows graphical environment version 3.0 that combines
visual design tools with a powerful, general-purpose programming
language and Windows .EXE compiler. It provides a simple solution to
the complex task of creating real Windows-based software applications.
Microsoft SQL Server is an intelligent client-server relational
database management system (RDBMS) for PC networks. Providing
capabilities previously the exclusive domain of mainframe and
minicomputer systems, Microsoft SQL Server brings high-end
performance, security, and data integrity to local area networks,
allowing data to be shared safely among many applications and users.
Microsoft SQL Server is supported by popular networks such as
Microsoft LAN Manager, Novell(R) NetWare(R) and IBM LAN Server.
Microsoft Corporation (NASDAQ "MSFT") develops, markets, and supports
a wide range of microcomputer software for business and professional
use, including operating systems, languages and applications, as well
as books, hardware and CD-ROM products for the microcomputer
marketplace.
*Prices listed are U.S. suggested retail prices.
###
Microsoft and the Microsoft logo are registered trademarks and Visual
Basic and Windows are trademarks of Microsoft Corporation.
Database Gateway is a trademark of Micro Decisionware.
DB-Library is a trademark of Sybase, Inc.
IBM is a registered trademark and DB2 is a trademark of International
Business Machines Corporation.
Novell and NetWare are registered trademarks of Novell, Inc.
For pricing and availability outside the U.S., please contact your
local subsidiary.

Knowledge Base

Title: PR Microsoft Visual Basic
Document Number: Q72316 Publ Date: 22-MAY-1991
Product Name: Microsoft News Releases
Product Version:
Operating System:

Microsoft Visual Basic
May 1991
Introduction
------------
The Microsoft(R) Windows(TM) graphical environment offers many
benefits to end users -- ease of use, user interface consistency,
interapplication integration -- but poses new challenges for
programmers. Writing Windows applications poses a challenge to
programmers because the available development tools lack the very
combination of functionality and ease of use that the applications
themselves feature.
Tools for Developing Graphical Applications
-------------------------------------------
Microsoft Windows applications make doing powerful things easy. The
Microsoft Visual Basic(TM) programming system creates applications
that tap into such Windows functionality as rich forms and controls,
pull-down menus, graphics and animation, dynamic data exchange (DDE)
and multi-tasking. These are difficult for Windows programmers using
traditional tools to develop, but very easy to achieve in the
Microsoft Visual Basic programming system. In general, software
development tools have resided at either end of a spectrum, and each
extreme forced developers to make tradeoffs. High-level tools allow
faster development, which is paid for in reduced flexibility and
control and greater runtime overhead. Low-level tools provide better
control and less overhead, but require more programming skill. Thus,
choosing a tool often involves making an undesirable compromise.
Microsoft Visual Basic: Real Windows Applications Really Fast
-------------------------------------------------------------
Microsoft Visual Basic programming system is a general-purpose
graphical application development system for the Microsoft Windows
environment that bridges the extremes of the tool spectrum described
above. The Visual Basic system addresses the need for a Windows
programming solution that is both serious and easy to use. It is
specifically designed to accelerate Windows version 3.0 development by
harnessing the power of the graphical environment to make mainstream
programmers more productive. Visual Basic helps programmers create
real Windows applications real fast. Extremely easy to use, it is the
ultimate productivity tool.
Visual Basic Key Features
-------------------------
The following is a description of the key features of the Microsoft
Visual Basic programming system.
Visual Design Tools for the User Interface
------------------------------------------
The Visual Basic system offers rich design tools that enable the
visual components of an application to be designed with drawing tools.
No code is required to create graphical user interfaces. Programs are
designed, created and run within the target Windows environment.
With Visual Basic programming system, windows and dialog boxes are
designed visually by selecting a tool from the Toolbox of controls and
then placing and sizing them on a form. All the Windows controls are
included in the Toolbox: command buttons, option buttons, check boxes,
simple and drop-down list boxes and combo boxes, text fields, labels
(static text), pictures (that can display icons, bitmaps, Windows
metafiles and programmatic graphics), Frame (to visually and
functionally group controls), Timer (that responds to the system
clock), scroll bars, and file system controls (drives, directory and
file list boxes). These controls have the appearance and behavior of
Windows controls such as three-dimensional command buttons that push
in and out, scroll bars that scroll, and edit fields that accept text
input and support cutting and pasting without writing any code.
Visual design tools are also used to set the attributes of a form's
appearance and behavior, from within the Visual Basic environment. The
Property Bar provides a list of available properties for each type of
control. A color palette offers a visual way to assign color
properties. Menus, complete with access keys and accelerators, are
created in outlining fashion in a menu design window. A project or
application can include many forms.
A Structured, Powerful Programming Language
-------------------------------------------
The Visual Basic language is a powerful, structured, general-purpose
programming language. It is a derivative of the Microsoft
QuickBasic(TM) modern programming system. Visual Basic language offers
all the modern programming structures such as Subs and Functions,
Block If...Then...Else..., Select Case, Do While/Until, For/Next and
error trapping with an easy-to-learn syntax.
An Event-Driven Programming Model
---------------------------------
The Visual Basic system introduces a high-level, event-driven
programming model that is especially suited for programming in a
graphical environment. Events such as mouse clicks and key presses are
automatically detected and processed by the system. The Visual Basic
programmer doesn't need to deal with event trapping or Windows message
dispatching and can simply tell the Visual Basic application how to
respond to a specific recognized event on a particular form or
control. The Visual Basic system's visual design tools, combined with
its event-driven nature, free the programmer to think of how the
application should look and behave, instead of having to concentrate
on lower-level system events or coding the user interface.
A Fast, Responsive Coding and Debugging Environment
---------------------------------------------------
The Microsoft Visual Basic programming system's combination of an
intuitive front-end building tool with an easy-to-learn programming
language creates a highly productive development environment.
Further productivity is realized by the system's threaded p-code
incremental compiler, a technology first introduced in Microsoft
QuickBasic programming system version 4.0 in 1987. Each line of code
is automatically parsed and incrementally compiled as soon as it is
typed in. Syntax errors are trapped immediately, alerting the
programmer to any syntax problem. The incremental compilation allows a
very fast transition from Design mode to Run mode. Break mode is also
available when the program encounters a runtime error or a breakpoint
in the code. The programmer can then single-step or procedure-step
through the application. The programmer also can set the next
statement to be executed anywhere within a procedure. An Immediate
window lets the programmer interact with the application while it is
temporarily suspended in the running state. The programmer can check
or even change the value of a variable, or enter any valid line of
code, which is directly executed without affecting the source code.
The programmer can then copy code entered in the Immediate window to
the Code window, to be included in the program's source code. This
revolutionary technology, first introduced in Microsoft QuickBasic
system version 4.0, is the threaded p-code incremental compiler.
For additional productivity, help is readily available in both online
and printed form. A detailed computer-based tutorial gets the user up
and running fast, and manuals (Programmer's Guide and Language
Reference) provide further training and reference materials. Context-
sensitive online Help provides readily available reference information
on the programming language and environment. Code examples from Help
can be copied and pasted to an application's source listing.
The Ability to Create Real Windows .EXE Files
When a program is designed, coded, debugged and fully functional, the
programmer simply chooses Make EXE File from the File menu to create
an .EXE file that can be freely distributed, without any royalties or
runtime fees. .EXE files can have all the features generally
associated with Microsoft Windows programs, such as multiple windows,
pull-down menus, standard controls (command buttons, text fields,
option buttons), graphics and icons, drag-and-drop and DDE.
Interoperability and Extensibility
----------------------------------
Microsoft Visual Basic programming system gives programmers access to
DDE and dynamic link libraries (DLLs) for interoperability and
extensibility with other applications. Interapplication communication
and integration is available via DDE. Visual Basic applications can be
DDE clients, servers or both. The environment offers high-level DDE
(paste-link) as well as programmable DDE in the language. Visual Basic
environment includes a rich set of DDE events (LinkOpen, LinkClose,
LinkExecute, LinkError), properties (LinkMode, LinkTopic, LinkItem,

LinkTimeout), and methods (LinkExecute, LinkPoke, LinkRequest,
LinkSend).
Visual Basic programmers can access external routines in DLLs,
including directly calling the Windows API (applications programming
interface). This is accomplished with a very straightforward syntax. A
one-line Function or Sub Declaration is all that is required to use an
external DLL routine as though it were built into the Visual Basic
system's language.
Users can gain powerful additional functionality by extending the
Microsoft Visual Basic development environment with custom controls.
Microsoft has separately announced the Visual Basic Control
Development Kit, which allows Windows developers to create extensions
to the Visual Basic system. Custom controls can have predefined
properties and events and some built-in functionality, just like the
standard controls in the Visual Basic Toolbox. A Visual Basic
programmer can load a custom control into a project, then assign
properties and write code for it just as though it were a built-in
control. Custom controls, like the standard ones, can trap events and
call the appropriate event procedures written in Visual Basic
language. This mechanism allows the Visual Basic environment to be
extended in many different ways, providing custom user-interface
components and specialized functionality such as multimedia, data
access or communications capabilities.
Visual Basic For High Productivity
----------------------------------
Visual Basic programming system is designed to make Windows
application developers more productive regardless of skill level or
application complexity. Its tightly integrated graphical development
environment helps move applications from concept to executable code in
the shortest possible time.
The Visual Basic User
---------------------
Users of the Microsoft Visual Basic system have the common task of
creating Windows applications, although they come to it with different
backgrounds and skills. They are professional programmers working with
small ISVs, VARs and system integrators; part-time programmers,
including engineers, scientists, analysts and educators; corporate
development staff and MIS professionals; and general PC "power users"
who want to create their own Windows applications. Visual Basic system
doesn't require programming experience, but it is helpful if the user
is familiar with general programming concepts. Anyone who has written
a macro or batch file, or has programmed in any high-level language,
can be productive very quickly with Microsoft Visual Basic. Using the
Visual Basic system, programmers can carry out a variety of tasks,
including writing standalone GUI applications; integrating
applications; developing application front ends, utilities or tools,
and graphical display-oriented programs; and prototyping.
Summary
-------
As Microsoft Windows grows in popularity, development environments are
naturally evolving toward graphical hosts, allowing programmers to
realize the productivity benefits of the graphical user interface.
Microsoft Visual Basic programming system is a low-cost (under $200
U.S. suggested retail price) Microsoft Windows-hosted and targeted
development tool that uses an event-driven programming model. It
offers high-level visual design tools to help programmers develop
interfaces. A graphical tool for graphical systems, the Visual Basic
programming system provides a simple solution to the otherwise complex
task of creating and integrating real Windows applications. It is the
only general-purpose, high-productivity programming system for the
Microsoft Windows environment.
###
Microsoft and the Microsoft logo are registered trademarks and Visual
Basic, Windows and Microsoft QuickBasic are trademarks of Microsoft
Corporation.
For pricing and availability outside the U.S., please contact your
local subsidiary.

Knowledge Base

Title: PR Microsoft Announces Update of FORTRAN Compiler
Document Number: Q72560 Publ Date: 30-MAY-1991
Product Name: Microsoft News Releases
Product Version:
Operating System:

Microsoft Announces Update of FORTRAN Compiler
That Taps the Power of Microsoft Windows
REDMOND, Wash. -- May 28, 1991 -- Microsoft today announced the
Microsoft(R) FORTRAN professional development system version 5.1,
bringing the power of the Microsoft Windows(TM) graphical environment
to FORTRAN developers. This new version introduces the QuickWin
library, which allows programmers to port DOS* applications to the
Windows environment without modifying their code. It also supports the
development of Windows DLLs (dynamic link libraries) for inclusion in
mixed-language applications.
New QuickWin Library Turns DOS Programs into Windows Programs
-------------------------------------------------------------
By providing access to Windows, the QuickWin library allows FORTRAN
applications to take advantage of extended and virtual memory -- over
16 MB on 80386 computers. This is done simply by recompiling DOS
applications in Microsoft FORTRAN and linking them to the Microsoft
QuickWin library. Most 16-bit applications can be moved to the Windows
environment without changes to the source code. Microsoft plans to
incorporate the QuickWin library in other language products as well.
"FORTRAN programs usually require a lot of memory for program and
data," said Fred Gray, general manager of the languages business unit
at Microsoft. "Now programmers can create bigger applications and also
take advantage of the power of the Windows environment."
The QuickWin library provides a fast way to port character-based
FORTRAN applications to the Windows graphical environment, taking
advantage of the advanced features Windows computing offers. For
example, programmers can add custom-sized child windows, window titles
and message boxes to their QuickWin applications. QuickWin
applications can access all memory available under the Windows
environment. "The QuickWin library allows us to expand easily the data
matrices used by our fault tree analysis applications without concern
for running out of memory," said Bill Debus, manager of software
engineering for a major aerospace company.
New Links Facilitate Mixed-Language
Programming in Windows Applications
-----------------------------------
Programmers can now link FORTRAN object code and dynamic-link
libraries to Windows applications. Existing FORTRAN code can be used
when developing full-featured Windows applications, such as those
written in Microsoft C or with the Microsoft Visual Basic(TM)
programming system. DLLs can also be used as repositories for FORTRAN
algorithms that are shared by multiple Windows applications.
"Being able to reuse our established FORTRAN libraries as Windows DLLs
allows us to speed up migration of our Simusolve modeling software
from host machines to the Windows environment," said Gary Agin,
software developer at the Dow Chemical Company.
Windows Provides Access to Analysis Tools
-----------------------------------------
The ability to develop Windows-based FORTRAN applications will be
welcomed by Microsoft FORTRAN users, over 50 percent of whom have the
Microsoft Windows environment. The Microsoft Windows environment
allows FORTRAN programmers to exchange data easily with popular
analysis tools that run in the Windows environment, such as Microsoft
Excel. FORTRAN output can be cut-and-pasted into Microsoft Excel or
other Windows charting software for custom graphic display.
VAX, IBM Syntax Compatibility
-----------------------------
Microsoft's optimizing FORTRAN compiler supports ANSI 77 and numerous
IBM(R), VAX(R) and ANSI 8x extensions. Support for IBM and VAX
extensions is particularly significant for the vast majority of
applications ported to PCs, approximately half of which are from IBM
mainframes and half from the VAX environment. These extensions, along
with the QuickWin technology, may enable the migration of traditional
FORTRAN code in minicomputer and mainframe environments to the Windows
graphical environment.
An Integrated Toolset Speeds Application Development
----------------------------------------------------
As with all other Microsoft professional development systems, FORTRAN
professional development system version 5.1 includes a complete set of
integrated tools and utilities for developing programs. This set
includes the Microsoft CodeView(R) debugger, Advisor online help, the
Source Browser and the complete Microsoft Programmer's WorkBench. The
CodeView debugger has been improved to take advantage of extended
memory for debugging large DOS applications, as well as for supporting
Windows and OS/2(R) programs.
Pricing and Availability
------------------------
Microsoft FORTRAN professional development system version 5.1 will be
available in June 1991 for a suggested retail price of $450. Licensees
of previous versions of Microsoft FORTRAN can receive an update for
$150 until June 1, 1992.
Microsoft Corporation (NASDAQ "MSFT") develops, markets and supports a
wide range of software for business and professional use, including
operating systems, network products, languages and applications as
well as books, CD-ROM products and hardware for the microcomputer
marketplace
*As used herein, "DOS" refers to the MS-DOSR and PC-DOS operating
systems.
###
Microsoft, the Microsoft logo, CodeView and MS-DOS are registered
trademarks and Visual Basic and Windows are trademarks of Microsoft
Corporation.
OS/2 is a registered trademark licensed to Microsoft Corporation.
Simusolve is a registered trademark of Dow Chemical Company.
IBM is a registered trademark of International Business Machines
Corporation.
VAX is a registered trademark of Digital Equipment Corporation.
For pricing and availability outside the U.S., please contact your
local subsidiary.

Knowledge Base

Title: PR MS Visual Basic for Windows Wins Overall "Best of Show"
Document Number: Q72561 Publ Date: 30-MAY-1991
Product Name: Microsoft News Releases
Product Version:
Operating System:

Microsoft Visual Basic for Windows Wins Overall
"Best of Show" at COMDEX/Spring and Windows World
REDMOND, Wash., -- May 29, 1991 -- "Microsoft Visual Basic represents
the "best of the bests" in a field of hundreds of new introductions at
COMDEX and WINDOWS WORLD," said Fred Langa, editor in chief of BYTE
magazine. Show organizers -- The Interface Group and BYTE magazine
editors -- selected the Visual Basic(TM) programming system as the
most exciting new product which will have the most industry impact.
The Visual Basic system also received the "Best of Spring" award for
the Best Windows(TM) Utility. The Visual Basic programming system is a
graphical application development system for Microsoft(R) Windows
graphical environment version 3.0, and combines visual design tools
with a powerful, general-purpose programming language and Windows .EXE
compiler.
The Visual Basic system was introduced May 21, 1991, at a press
conference attended by more than 600 corporate customers, developers
and journalists. Microsoft founder and CEO Bill Gates forecasts that
many more thousands of Windows applications will be written in the
Visual Basic language. Forty-five independent software developers
announced and demonstrated more than 60 products ranging from custom
controls to add-on DLLs for data access and multimedia applications.
Charles Stevens, general manager of the Microsoft data access business
unit, said "Our goal was to make creating real Windows applications
incredibly easy and fast. This award represents an affirmation of our
strategy of combining a rich set of visual design tools with a
powerful, event-driven programming language to achieve just that.
"We also appreciate the feedback from our customers, independent
software vendors and beta sites that helped us build the product they
wanted and which continue to guide our future directions."
Visual Basic programming system for Windows will be available in June
1991 for a U.S. suggested retail price of $199. German and French
versions are scheduled to ship in August, with other language versions
to follow.
Microsoft Corporation (NASDAQ "MSFT") develops, markets and supports a
wide range of software for business and professional use, including
operating systems, network products, languages and applications as
well as books, CD-ROM products and hardware for the microcomputer
marketplace.
###
Microsoft and the Microsoft logo are registered trademarks and Visual
Basic and Windows are trademarks of Microsoft Corporation.
For pricing and availability outside the U.S., please contact your
local subsidiary.

Knowledge Base

Title: How to Create Flashing/Rotating Rubber-Band Box in VB
Document Number: Q71489 Publ Date: 17-JUN-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
Several programs, such as Excel, create a flashing border (which
appears to rotate) when selecting items of the windows when using the
Edit Copy selection of the menu system. You can create a flashing,
rotating border with the DrawMode and DrawStyle properties of a Visual
Basic form.
This information applies to Microsoft Visual Basic Programming System
version 1.00 for Windows.
More Information:
By drawing a dashed line on the form and then within a timer event
creating a solid line on the dashed line with DrawMode set to INVERSE,
you can create a special effect of a flashing border that appears to
rotate.
You can draw a rotating rubber-band box as follows:
1. Draw a line using:
DrawStyle = 2 {Dot}
2. Save the [form|.DrawMode and the [form|.DrawStyle.
3. Set the [form|.DrawMode = 6 {Inverse}.
4. Set [form|.DrawStyle = 0 {Solid}.
5. Draw the same line as in step 1.
6. Reset the properties saved in step 2.
7. Delay some time interval.
8. Repeat starting at step 2.
The following code demonstrates the rotating (flashing) border.
Pressing the mouse button and then dragging the cursor some distance
will create a dotted line. Releasing the button will display a
rotating rubber-band box.
In VB.EXE, create a form called Form1. On Form1, create a timer
control with the name Timer1 and with an interval of 100.
Duplicate the following code within the general declaration section of
your code window:
Const INVERSE = 6 'Characteristic of DrawStyle property(Inverse).
Const SOLID = 0 'Characteristic of DrawMode property.
Const DOT = 2 'Characteristic of DrawMode property.
Const TRUE = -1
Const FALSE = 0
Dim OldX, OldY, StartX, StartY As Single
Add the following code in the appropriate event procedures for Form1:
Sub Form_Load ()
'* Must draw a dotted line to create effect. Load a bitmap. Not
required but shows full extent of line drawing.
DrawStyle = DOT
End Sub
Sub Timer1_Timer ()
SavedDrawStyle% = DrawStyle
'* Solid is need to create the inverse of the dashed line.
DrawStyle = SOLID
'* Invert the dashed line.
Call DrawLine(StartX, StartY, OldX, OldY)
'* Restore the DrawStyle back to what it was previously.
DrawStyle = SavedDrawStyle%
End Sub
Sub Form_MouseDown (Button As Integer, Shift As Integer, X As
Single, Y As Single)
' The above Sub statement must be on just one line.
'* Don't add effect as you draw box.
Timer1.Enabled = FALSE
'* Save the start locations.
StartX = X
StartY = Y
'* Set the last coord. to start locations.
OldX = StartX
OldY = StartY
End Sub
Sub Form_MouseMove (Button As Integer, Shift As Integer, X As
Single, Y As Single)
' (The above Sub statement must be on just one line.)
'* If button is depress then...
If Button Then
'* Restore previous lines background.
Call DrawLine(StartX, StartY, OldX, OldY)
'* Draw new line.
Call DrawLine(StartX, StartY, X, Y)
'* Save coordinates for next call.
OldX = X : OldY = Y
End If
End Sub
Sub DrawLine (X1, Y1, X2, Y2 As Single)
'* Save the current mode so that you can reset it on
'* exit from this sub routine. Not needed in the sample
'* but would need it if you are not sure what the
'* DrawMode was on entry to this procedure.
SavedMode% = DrawMode
'* Set to XOR
DrawMode = INVERSE
'*Draw a box
Line (X1, Y1)-(X2, Y2), , B
'* Reset the DrawMode
DrawMode = SavedMode%
End Sub
Sub Form_MouseUp (Button As Integer, Shift As Integer, X As Single,
Y As Single)
' (The above Sub statement must be on just one line.)
StartEvent = FALSE
Timer1.Enabled = TRUE
End Sub

Knowledge Base

Title: VB Can Determine When a Shelled Process Has Terminated
Document Number: Q72880 Publ Date: 17-JUN-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
The Shell function initiates a process and returns back to the Visual
Basic program. The process will continue indefinitely until you decide
to stop it. Terminating the Visual Basic program will not cause the
shelled process to terminate. However, you may not want this behavior
if you want the Visual Basic program to wait until the shelled process
has finished before continuing. This article describes a method by
which a Visual Basic program will wait until a shelled process has
terminated.
This information applies to Microsoft Visual Basic programming system
version 1.0 for Windows.
More Information:
By using the Windows API functions GetActiveWindow and IsWindow, your
program can monitor the status of a shelled process. The API function
GetActiveWindow should be called immediately after the Shell function
to get the window handle of the shelled process. This will work
correctly only if you invoke the Shell function using a window style
with focus, that is, window style 1, 2, or 3. By continually calling
the API function IsWindow from within a While loop, you can cause the
Visual Basic program to wait until the shelled process has terminated.
The Windows API function IsWindow simply checks to make sure that the
window associated with the handle found with GetActiveWindow is still
a valid window.
The Visual Basic program below uses the Shell function to execute
Windows's Calculator accessory. The program is an example of how to
use the Windows API functions GetActiveWindow and IsWindow to wait
until a shelled process has terminated before resuming execution.
Code Example
------------
'The Declare statements for Windows API functions need to be included
'in the Declarations section of the form or in the Global module.
'Assume that the following Declare statements are in the Declarations
'section of the default form (Form1).
Declare Function GetActiveWindow% Lib "User" ()
Declare Function IsWindow% Lib "User" (ByVal hWnd%)
'Below is the code contained within the Form_Load event procedure of
'the default form (Form1):
Sub Form_Load ()
x% = Shell("calc.exe", 1) ' Must Shell using a Window Style
' with focus, Window style 1, 2, or 3.
' You must immediately invoke GetActiveWindow%() for this
' technique to work:
ShellWindowHWnd% = GetActiveWindow%() 'Get the window handle
' of the shelled process.
While IsWindow%(ShellWindowHWnd%) 'Wait until the shelled
' process has been terminated.
x% = DoEvents() 'Process other Windows events.
Wend
End
End Sub

Knowledge Base

Title: How to Set Tab Stops Within a List Box in Visual Basic
Document Number: Q71067 Publ Date: 18-JUN-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
Visual Basic does not have any intrinsic function for creating
multi-column list boxes. To create multi-column list boxes, you must
call several Windows API function calls to set tab stops within the
list box. The tab stops create the multi-column effect.
This information applies to Microsoft Visual Basic Programming System
version 1.00 for Windows.
More Information:
Multi-column list boxes can be created by calling several Windows API
function calls. These functions are GetFocus, SendMessage, and
SetFocus.
The function GetFocus requires no parameters. This function will
return an integer value that represents the handle to the control. Use
GetFocus to get the handle to the control that currently has focus
upon entry to the event-handler procedure. After you store the handle
to the control that currently has focus, set the focus to the desired
list box.
After you set the focus to the list box, you must send a message to
the window's message queue that will reset the tab stops of the list
box. Using the argument LB_SETTABSTOPS as the second parameter to
SendMessage will set the desired tab stops for the multi-column list
box based on other arguments to the function. The SendMessage function
requires the following parameters for setting the tab stops
SendMessage (hWnd%,LB_SETTABSTOPS, wParam%, lparam)
where:
wParam% Is an integer that specifies the number of tab
stops in the list box.
lParam Is a long pointer to the first member of an array
of integers containing the tab stop position in
dialog units. (A dialog unit is a horizontal or
vertical distance. One horizontal dialog unit is
equal to 1/4 of the current dialog base-width unit.
The dialog base units are computed based on the
height and the width of the current system font.
The GetDialogBaseUnits function returns the current
dialog base units in pixels.) The tab stops must
be sorted in increasing order; back tabs are not
allowed.
After setting the tab stops with the SendMessage function, calling
PutFocus with the saved handle will return the focus back to the
control that had focus before the procedure call. PutFocus is the
Alias for the Windows API SetFocus function. The Windows API SetFocus
needs to be redefined using the "Alias" keyword because SetFocus is a
reserved word within Visual Basic.
To create multi-column list boxes within Visual Basic, create a list
box named Listbox1 on Form1. Declare the following Windows API
functions at the module level or in the Global section of your code as
follows:
Declare Function GetFocus Lib "user" () As Integer
Declare Function SendMessage Lib "user" (ByVal hwnd As Integer,
ByVal wMsg As Integer,
ByVal wp As Integer,
lp As Any) As Long
Declare Function PutFocus Lib "user" Alias "SetFocus"
(ByVal hWnd%) As Integer
Note: All Declare statements must each be written out on one line.
Also declare the following constants:
Const WM_USER = &H400
Const LB_SETTABSTOPS = WM_USER + 19
Include the following code within a SUB procedure:
Sub Form_Click ()
Static tabs(3) As Integer
hOldWnd% = GetFocus() 'Remember who had the focus.
list1.SetFocus 'Set the focus to the list box.
lbhWnd% = GetFocus() 'Get the handle to the list box.
'Set up the array of defined tab stops.
tabs(1) = 10
tabs(2) = 50
tabs(3) = 90
'Send a message to the message queue.
retVal& = SendMessage(lbhWnd%, LB_SETTABSTOPS, 3, tabs(1))
'Restore the handle to whoever had it.
R% = PutFocus(hOldWnd%)
'Place some elements into the list box.
list1.AddItem "Name" + Chr$(9) + "Rank" + Chr$(9) + "Serial#"
list1.AddItem "J. Doe" + Chr$(9) + "O-3" + Chr$(9) + "1234"
list1.AddItem "J. Blow" + Chr$(9) + "E-1" + Chr$(9) + "5678"
list1.AddItem "F. Smith" + Chr$(9) + "O-6" + Chr$(9) + "0192"
End Sub

Knowledge Base

Title: PR QBasic Interpreter Included with Each Copy of MS-DOS 5
Document Number: Q73245 Publ Date: 20-JUN-1991
Product Name: Microsoft News Releases
Product Version:
Operating System:

Modern Structured Programming Language,
QBasic Interpreter Included with Each Copy of MS-DOS 5
NEW YORK CITY -- June 11, 1991 -- Microsoft Corporation today
announced that Microsoft(R) MS-DOS(R) QBasic(TM) Interpreter, a
powerful, modern Basic interpreter, replaces GW-BASIC(R) interpreter
in the MS-DOS 5 operating system. The new MS-DOS QBasic Interpreter,
an interpreter-only subset of the award-winning Microsoft
QuickBasic(TM) compiler version 4.5, loads and runs most GW-BASIC
programs without modification while permitting far more powerful and
structured applications to be created. QBasic Interpreter is
completely upward-compatible with Microsoft QuickBasic compiler
version 4.5.
Basic, the world's most popular programming language, has been
included in the MS-DOS operating system since it first began shipping
in 1981. In MS-DOS 5, QBasic Interpreter replaces the 10-year-old GW-
BASIC interpreter.
"While our retail Basic products have grown and matured over the last
10 years, we've been looking for an opportunity to provide the same
modern syntax in the version that ships with MS-DOS, that we have in
our retail tools," said Mike Maples, vice president of applications at
Microsoft. "GW-BASIC and BASICA have been the first look at
programming for many computer users. We're excited that beginning
programmers, students and others interested in doing some casual
programming will now have a fully structured, modern programming
language to use -- MS-DOS QBasic Interpreter."
"More than 6 million PC users in the U.S. alone have used Basic in the
past year," said Charles Stevens, general manager of the Microsoft
data access business unit. "Our research shows that more people, both
professional programmers and average computer users, know Basic than
any other programming language. Microsoft now offers a complete line
of compatible Basic development tools for DOS*, from MS-DOS QBasic
Interpreter to Microsoft QuickBasic compiler to Microsoft Basic
professional development system. These are specifically tailored to
different customer segments, from the casual programmer and student to
the professional developer."
A Powerful Programming Tool
---------------------------
MS-DOS QBasic Interpreter, like other Microsoft Basic products, uses
the modern Basic language. Old commands and features such as GOTO,
GOSUB and line numbers are unnecessary (but are supported for backward
compatibility). MS-DOS QBasic Interpreter also supports true
procedures and functions with local variables, full parameter passing,
modern control-flow structures (including SELECT CASE, DO/WHILE
LOOP/UNTIL) nested block IFs, user-defined data types structures,
recursion, random, binary and sequential file I/O, and global error
handling.
To make learning the language easier, detailed online help is included
along with code examples that can be copied into a user's program. A
standard, easy-to-use interface using menus and dialog boxes supports
both the mouse and the keyboard and functions much like the user
interface in Microsoft Word version 5.5 or Microsoft Works. Other
features include break points to speed debugging and Search & Replace
for making large-scale changes.
Because Basic is an international favorite, the MS-DOS QBasic
Interpreter will be localized into several languages worldwide,
including Russian, French, German, Italian, Swedish, Dutch, Finnish,
Portuguese and Korean.
Product support is available from Microsoft OnCall(TM) for Basic** at
(900) 896-9999.
Programs written in QBasic language typically run six times faster
than those written in GW-BASIC or BASICA, and have more than twice the
capacity, 160 K versus 64 K. (Microsoft QuickBasic compiler and Basic
professional development system offer increased performance over MS-
DOS QBasic Interpreter with capacities of 640 K and 16 MB,
respectively.)
Available Books
---------------
More than a half-dozen books on MS-DOS QBasic Interpreter are
currently available or will be soon. Available now are Running QBasic
from Microsoft Press and QBasic Made Easy from Osborne/McGraw-Hill.
Scheduled for a July release are Using QBasic from Que Corporation,
Power QBasic and Teach Yourself QBasic from MIS Books. Howard W. Sams
& Company's First Book of QBasic and The Waite Group's QBasic Primer
Plus will be available in the fall.
Basic Products Available Today
------------------------------
In addition to the new MS-DOS QBasic Interpreter, Microsoft offers
several Basic products to meet the needs of different users:
o Microsoft Visual Basic(TM) programming system for the Microsoft
Windows(TM) graphical environment: announced on May 20 and now
shipping in quantities. Visual Basic system is the fast and easy way
to write applications for the Microsoft Windows graphical environment
version 3.0. It combines visual design tools with a powerful, event-
driven programming language and Windows executable program compiler to
enable any programmer to write full-featured Windows applications
quickly.
o Microsoft QuickBasic compiler version 4.5: the world's most popular
DOS-based Basic compiler/interpreter package is a superset of
MS-DOS QBasic Interpreter and adds the power to develop and compile
stand-alone executable programs that can be distributed freely. These
compiled .EXEs execute significantly faster than interpreted programs
and can access all the memory available under 640 K. Microsoft
QuickBasic compiler version 4.5 also has several additional debugging
tools such as a full range of watch variable features, multiple
modules and mixed-language programming support. Single-user and 10-
pack versions are available at a discount to students and schools for
teaching modern, structured programming.
o Microsoft Basic professional development system version 7.1: This
system is designed to offer the commercial application developer the
most powerful toolset available for creating finished DOS software
products fast. Basic version 7.1 includes the most powerful optimizing
Basic compiler available and generates the smallest and fastest
compiled .EXEs possible. It includes advanced memory management
features which make it possible to develop and compile Basic programs
as large as 16 MB using overlays, expanded memory, and far strings. It
also includes integrated data access in the form of Microsoft
Professional ISAM (indexed sequential access method) for data-
intensive business applications, the user interface toolbox for
creating professional user interfaces, and numerous other professional
language features and tools.
Microsoft Corporation (NASDAQ "MSFT") develops, markets and supports a
wide range of software for business and professional use, including
operating systems, network products, languages and applications as
well as books, hardware and CD-ROM products for the microcomputer
marketplace.
*"DOS" as used herein refers to the MS-DOS and PC-DOS operating
environments.
**$2.00 per call.
###
Microsoft, the Microsoft logo, GW-BASIC and MS-DOS are registered
trademarks and Microsoft QuickBasic, OnCall, QBasic, Visual Basic and
Windows are trademarks of Microsoft Corporation.
For pricing and availability outside the U.S., please contact your
local subsidiary.

Knowledge Base

Title: Huge Array Support in DLL for Visual Basic for Windows
Document Number: Q72585 Publ Date: 24-JUN-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
A dynamic-link library (DLL) is available that contains functions for
managing arrays larger than 64K from Microsoft Visual Basic version
1.0 for Windows. This DLL also provides the ability to create arrays
with more than 32,767 (32K) elements per dimension, and to redimension
arrays while preserving the data inside of the arrays.
This file can be found in the Software/Data Library by searching for
the filename BV0442, the Q number of this article, or S13082. BV0442
was archived using the PKware file-compression utility. When you
decompress BV0442, you will obtain the following files:
HUGEARR.DLL, HUGEARR.BAS, HUGEARR.C, HUGEARR.DEF, HUGEARR.H,
HUGEARR.TXT, MAKEFILE
These files are also available on disk in the application note "Huge
Array Support in DLL for Visual Basic for Windows" (BV0442) by calling
Microsoft Product Support Services.
This information applies to Microsoft Visual Basic programming system
version 1.0 for Microsoft Windows, and to Microsoft Windows 3.0
Software Development Kit (SDK). HUGEARR.DLL is provided only as an
example, which you are free to modify, and Microsoft makes no
performance or support claims for HUGEARR.DLL or its associated files.
More Information:
To use the functions in HUGEARR.DLL, copy the declarations contained
in HUGEARR.BAS into your global module in Visual Basic and copy
HUGEARR.DLL to your Windows directory. The functions can then be used
like any other Windows DLL function.
HUGEARR.DLL allocates memory using the Windows API function
GlobalAlloc. This means that the largest array that can be allocated
is 1 MB in standard mode, and 64 MB in 386 enhanced mode for Windows.
The following routines are contained in HUGEARR.DLL. For a complete
description of the parameters and/or return values of these routines,
see Visual Basic's Declare statement for the routine in question in
the file HUGEARR.BAS. For additional notes on using these functions,
see the HUGEARR.TXT reference file.
1. HugeDim:
Dimensions an array and returns a handle to that array.
2. HugeErase:
Erases an array that was previously dimensioned using HugeDim.
3. HugeRedim:
Redimensions an array created with HugeDim to a different size.
4. GetHugeEl, SetHugeEl:
Gets or sets the contents of the specified array element in a given
huge array.
5. HugeInt, HugeLong, HugeSingle, HugeDouble, HugeCurrency:
Functions that return a value from a specific element in a huge
array of the type corresponding to the function name (Integer,
Long, Single, Double, or Currency data type.)
6. HugeUbound:
Returns the upper bound of a given huge array.
7. NumHugeArrays:
Returns the number of free huge array handles available.

References:
HUGEARR.DLL is written in Microsoft C, and the C source code is
provided in HUGEARR.C and HUGEARR.H. Advanced programmers can
optionally modify and rebuild HUGEARR.DLL by using the Microsoft C
Compiler version 6.0 or 6.0a and DLL libraries from the Microsoft
Windows 3.0 Software Development Kit (SDK), and by running NMAKE.EXE
with the enclosed MAKEFILE. The MAKEFILE tells LINK.EXE to use the
enclosed linker definition file, HUGEARR.DEF.

Knowledge Base

Title: Wrong Default Path After Drive Error, VB Open/Add File Dialog
Document Number: Q72878 Publ Date: 25-JUN-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
When you choose the Open Project or Add File option from the File menu
in the VB.EXE environment, and you get an error accessing a disk
drive, Visual Basic incorrectly stays logged onto the failed drive
path (even though the previous path is displayed), unless you
explicitly change the drive. (This behavior differs from the Open
command from the File menu in standard Windows applications, such as
Microsoft Word for Windows and Microsoft Excel for Windows.)
Microsoft has confirmed this to be a problem in Microsoft Visual Basic
programming system version 1.0 for Windows. Microsoft is researching
this problem and will post new information here as it becomes
available.
To work around this problem, just change to a valid drive by typing a
path preceded by a valid drive letter, or by selecting a valid drive
letter with the mouse.
More Information:
To duplicate this problem, follow these steps:
1. Start Visual Basic (such as from the C:\VB\ subdirectory for the
following example).
2. From the File menu, choose Open Project or Add File. (The Open
Project or Add File dialog box lets you search for and select the
file you want.)
3. Make sure drive A is empty and open.
4. Select [-a-| from the dialog box. A message box will correctly
appear with the error message "Path Not Found:'' ". (What appears
to be one double quotation mark is really two single quotation
marks with nothing between them.)
5. Choose the OK button. Note that the current path, such as C:\VB
(displayed above the Directories box), is correctly shown to be the
same as before drive A was selected. The Files and Directories
boxes also correctly show the same files as before drive A was
selected. (So far, this behavior is the same as for the files
dialog box in standard Windows applications.)
6. Erase the information in the File Name field, and type the
following:
*.*
7. Choose the OK button.
8. The problem is that Visual Basic now incorrectly gives you the
"Path Not Found:'' " error message, which demonstrates that the
actual current drive fails to match the displayed path (C:\VB), and
Visual Basic is incorrectly attempting to access drive A again.
This behavior differs from standard Windows applications, such as
Microsoft Word for Windows and Excel for Windows, which don't give
an error at this point, and instead correctly show all (*.*) files
in the path (C:\VB) displayed in the dialog box.
To work around this problem, just change to a valid drive by typing
a path preceded by a valid drive letter, such as C:\VB\*.*, or by
selecting a valid drive letter, such as [-c-| with the mouse.

Knowledge Base

Title: Settings Box Is Hidden When Properties Bar at Bottom of Screen
Document Number: Q72881 Publ Date: 25-JUN-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
When the Properties bar is positioned at the bottom of the screen and
an enumerated property, such as FontName, is selected from the
Settings box, the FontName list is still displayed beneath the
Properties bar, instead of above the Properties bar, making the
FontName list essentially invisible. Because of this behavior,
Microsoft recommends leaving the Properties bar at the top of the
screen.
Note: The Properties bar's entry field is not a combo box, and does
not react as a combo box.
This information applies to Microsoft Visual Basic programming system
version 1.0 for Windows.
More Information:
When you open a combo box and the space below is insufficient to
display the drop-down list, the list will be displayed above the combo
box window. This is exactly how the combo box "Properties list box"
displays when the Properties bar is moved to the bottom of the screen.
Although the Settings box resembles a combo box, the Settings box is
actually an edit box and a push button. This window is not a combo box
because the push button can take on several functions. In some cases
the Settings box is disabled, and in some cases it invokes a pop-up
dialog box (for example, when you select the Picture property of the
Picture control). In other cases, such as for the FontName property,
the Settings box displays a Windows list box just under the Properties
bar. The location of the list box is determined by Visual Basic and
will always be displayed below the Properties bar.
Microsoft recommends leaving the Properties bar at the top of the
screen.
Reference:
Please refer to pages 38-39 of the "Microsoft Visual Basic:
Programmer's Guide" for version 1.0 for definitions of Properties bar,
Properties list box, and Settings box.

Knowledge Base

Title: Why VB Sub Might Stay in Proc: List Even After Code Deleted
Document Number: Q73270 Publ Date: 25-JUN-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
In a Visual Basic code window, if you want to delete the code for a
Sub...End Sub procedure (or Function...End Function procedure), you
must also delete the two or more blank lines (if any) following that
procedure, or else that procedure will still exist (in a blank code
window and in the Proc: box).
Microsoft has confirmed this to be a problem in Microsoft Visual Basic
version 1.0 programming system for Windows. We are researching this
problem and will post new information here as it becomes available.
To work around this problem, make sure to delete all blank lines in
the code window for the procedure that you want to delete.
More Information:
Steps to Reproduce Problem
--------------------------
1. Start Visual Basic (or select New Project from Visual Basic's File
menu if you are already in Visual Basic).
2. Double-click Form1, or press F7, to display the form's Code window.
3. Choose (general) from the Object: box, and enter the statement
Sub Sub1 in the (general) (declarations) code window, and press the
ENTER key. This causes Visual Basic to display the following Sub
procedure:
Sub Sub1()
End Sub
4. Press CTRL+END, or click to the blank line after the End Sub
statement.
5. Press the ENTER key to add a few blank lines after the End Sub
statement.
6. Using the mouse, select (highlight) from the Sub Sub1() statement
to the End Sub statement (but to duplicate the problem, don't
highlight the blank lines after the End Sub statement). From the
Edit menu, choose Delete, or press the DEL key, to delete the
selected text.
7. Now the Proc: box still indicates that Sub1 exists as a procedure,
even though you just tried to delete it.
This problem is caused by the blank lines that were added after the
End Sub statement. To work around the problem, highlight and delete
the blank lines in the Sub1 code window, and the Sub1 procedure will
be properly deleted.
Additional reference words: 1.00

Knowledge Base

Title: Can't Get Help Within Any VB Dialog Box After an Error
Document Number: Q73119 Publ Date: 25-JUN-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: MS-DOS

Summary:
If you are in any Visual Basic dialog box and an error occurs, after
you dismiss the error message, pressing F1 to get help for the dialog
box will result in getting help on the previous error message, not
help on the dialog box.
Microsoft has confirmed this problem in Microsoft Visual Basic
programming system version 1.0 for Windows. We are researching this
problem and will post new information here as it becomes available.
More Information:
The following steps reproduce the error:
1. From the File menu, choose Save Project.
2. Enter an invalid filename for saving the project.
3. An error message will pop up telling you that the filename is
incorrect.
4. Press ENTER or double-click the OK button to dismiss the error
message.
5. Press the F1 key to get help on the Save Project dialog box.
6. The help message for the error will pop up, instead of help for the
dialog box.
This behavior is incorrect. The above steps should give you help for
the Save Project dialog box.
To work around the problem and get correct help on this dialog box,
dismiss the incorrect error message by double-clicking the control
button, and click CANCEL to get rid of the Save Project dialog box.
Now, choose Save Project from the File menu and press F1; the correct
help should display.
To get help on the error message, press F1 while the error message is
displayed.

Knowledge Base

Title: "Method Not Applicable..." with IsHidden Method in VB
Document Number: Q73154 Publ Date: 25-JUN-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
"IsHidden" was a method implemented in prerelease versions of Visual
Basic, but IsHidden was removed in the released version (because it
was no longer needed). However, using IsHidden as the name for a
variable, Sub, Function, or object can still give the following error
at run time:
Method not applicable with this Object
To work around this problem, avoid using the name IsHidden.
This information applies to Microsoft Visual Basic programming system
version 1.0 for Windows.
More Information:
The following example demonstrates the problem:
1. Within any event procedure, try the following:
Sub Form_Click()
print ishidden
End Sub
2. This gives a syntax error asking you to add a "(" to the method,
so continue by adding "()":
Sub Form_Click()
print ishidden()
End Sub
3. This results in the following format after pressing ENTER after
ishidden():
Sub Form_Click()
Print IsHidden()
Sub End
This is the format for a predefined method called IsHidden().
After following the steps above, you will receive a run-time error
"Method not applicable with this Object." This error results because
this particular method was not completely unimplemented from the beta
version.
Microsoft will consider completely removing this behavior of the
IsHidden name in a future version of Visual Basic.

Knowledge Base

Title: Make EXE with 40-Byte Title Displays Only 39 in Task List
Document Number: Q73155 Publ Date: 25-JUN-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
This information applies to Microsoft Visual Basic programming system
version 1.0 for Windows.
The following steps demonstrate a problem with Microsoft Windows 3.0;
the problem is not caused by Microsoft Visual Basic version 1.0:
1. Start Visual Basic.
2. From Visual Basic's File Menu, choose the Make EXE File command.
3. A Make EXE File dialog box will display. Enter a 40-character
filename in the File Name box.
4. Double-click the OK command button to exit the dialog box.
5. Minimize Visual Basic, go to the Windows Program Manager menu, and
choose File.
6. From the File menu, choose the Run option; the Run dialog box will
display.
7. Now enter that 40-character .EXE filename or path to the .EXE
filename in the Command Line box, and double-click OK when done.
8. The .EXE file will run correctly, but if you press CTRL+ESC to
bring up the Task List box, you will see that your .EXE filename
has been truncated to 39 characters (it no longer is 40
characters).
Microsoft has confirmed this problem in the Microsoft Windows version
3.0 operating system (buglist3.00). We are researching this problem
and will post new information here as it becomes available.
Additional reference words: 3.00

Knowledge Base

Title: Removing Disk During VB Setup Terminates SETUP, Missing Files
Document Number: Q73157 Publ Date: 25-JUN-1991
Product Name: Microsoft Visual Basic
Product Version: 1.00
Operating System: WINDOWS

Summary:
While running SETUP.EXE for Visual Basic, you may fail to copy all
files (or experience other problems) if you try to remove the disk
while the SETUP.EXE program is in progress.
Microsoft has confirmed this problem in Microsoft Visual Basic
programming system version 1.0 for Windows. We are researching this
problem and will post new information here as it becomes available.
To work around this problem, wait until SETUP indicates that 100
percent of the files are copied before removing the Visual Basic
floppy disk.
More Information:
Below is an example of one specific problem:
When running SETUP.EXE on Disk 1 of Visual Basic (using 1.2 MB 5.25-
inch disks), you can choose the option to install Visual Basic only.
SETUP's bar graph will start by displaying 4 percent done, and while
the large file C:\VB\VB.EXE is being copied, the disk drive light may
go off and you might assume that Visual Basic is finished running
SETUP. At this point you might (mistakenly) remove Disk 1. Then a
message tells you that SETUP is complete, and you can exit SETUP.
You have now installed VB.EXE, but you did not install some of the
other important files, such as VBRUN100.DLL, which is needed to run
your compiled applications under Windows version 3.0.
If you want to install Visual Basic by selecting Visual Basic only,
then you need to let Disk 1 complete its processing by waiting until
the bar displays 100 percent. If you let Disk 1 run to completion,
then the installed directory C:\VB should correctly contain the
following files:
VB.EXE
VB.HLP
VBRUN100.DLL
README.TXT
PACKING.LST
SETUP.EXE
DECOMP.DLL
CONSTANT.TXT
Additional reference words: 1.00 3.00


 December 22, 2017  Add comments

Leave a Reply