 1 "Not Enough Memory to Load Tutorial" with Corrupt VB.LES File
 2 How to Get Windows Master List (Task List) Using Visual Basic
 3 In VB, Clipboard.SetData Gives "Invalid Format" with Icon
 4 Sales Specification for Visual Basic Available
 5 Breakpoint in LostFocus Event Procedure Can Hang VB.EXE
 6 CTRL+LEFT/RIGHT ARROW Different in Editor vs. Immediate Window
 7 Nonstandard Icons Can Make Visual Basic Hang or Display UAE
 8 VB Dynamic Drive Control Arrays Don't Get Correct Coordinates
 9 Memory Limits in Visual Basic for Windows
10 Restart in VB Break Mode if Delete Blank Line Above End Sub
11 "Printer Error" Printing VB Form to Text-Only Printer
12 How to Sub-Class a VB Form Using VB CDK Custom Control
13 VB CDK Custom Property Name Cannot Start with Numeric
14 No New Timer Events During Visual Basic Timer Event Processing
15 DEL Key Behavior Depends on Text Box MultiLine Property
16 VB Can Call Escape API to Specify Number of Copies to Printer
17 "Out of Memory" May Lead to Unstable Visual Basic Environment
18 Incorrect Jumps in Visual Basic Online Help "How To" Section
19 VB SETUP.EXE "Insufficient Disk Space on: C:\WINDOWS"
20 List of Visual Basic Third-Party Add-On Products Available
21 Visual Basic List Box Won't Open if Resized at Run Time
22 Visual Basic Code Window Hides Split View if Resized
23 In VB, Format$ Using # for Digit Affects Right Justification
24 VB "Illegal Function Call" Under Windows Low Memory Condition
25 VB Multiline Text Box Memory Not Freed when Form Is Unloaded
26 VB Extra Resize Event when WindowState Not Normal (Not 0)
27 Text Too Narrow with Italic Fonts in Visual Basic Labels
28 "Invalid Outside Sub," Copy/Paste to VB General Declarations
29 Resetting ListIndex Property Generates Click Event
30 Property Values Incorrect for a Maximized Form in VB
31 VB.EXE "Save Text" Overwrite Prompt Can Show Unusual .. Path
32 Corrections for Errors in Visual Basic Version 1.0 Manuals
33 Correction to WINAPI.TXT for Visual Basic Add-on Kit
34 Creating Nested Control Arrays in Visual Basic
35 Incorrect Error 71 Opening File on Write Protected Disk
36 High Granularity Setting Affects Windows/VB Form Resizing
37 In VB DDE, LinkRequest "Unexpected Error: Quitting"


Knowledge Base

Title: "Not Enough Memory to Load Tutorial" with Corrupt VB.LES File 
Document Number: Q78000           Publ Date: 19-NOV-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 If you try to run the Visual Basic tutorial when it is not actually 
 installed or the file VB.LES has become corrupted, a message box will 
 state "Not Enough Memory To Load Tutorial." A workaround is described 
 further below. 
 This information applies to Microsoft Visual Basic version 1.0 for 
 Microsoft Windows. 
 More Information: 
 The subdirectory \VB\VB.CBT\ contains files for the Visual Basic 
 tutorial. If the file VB.LES has been modified or replaced by another 
 file, the tutorial cannot be run and two erroneous dialog boxes will 
 open. 
 The first dialog box has the title "Visual Basic Tutorial" and 
 displays the message "Out of memory". Choosing the OK button will 
 clear this box and another one will open. 
 The second dialog box is titled "Microsoft Visual Basic," which 
 displays the message "Not enough memory to load tutorial." Choose the 
 OK button to clear this box. 
 The messages displayed in these dialog boxes are incorrect and should 
 be ignored. To correct this problem, reinstall Visual Basic so that 
 VB.LES will be replaced by the correct file. 
 Note: To properly reinstall Visual Basic, you must first delete all 
 files from the previous installation. Remember to save all of your 
 program files (*.FRM, *.MAK, and so on) before deleting the previous 
 installation. 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: How to Get Windows Master List (Task List) Using Visual Basic 
Document Number: Q78001           Publ Date: 19-NOV-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 By calling the Windows API functions GetWindow, GetWindowText, and 
 GetWindowTextLength, you can get the window titles of all windows 
 (visible and invisible) loaded under Windows. The list of all of the 
 window titles under Windows is known as the master list. The Windows 
 Task Manager contains a list of the window titles for each of the 
 top-level windows (normally one per application). This list is know as 
 the task list. 
 Further below is a sample program that demonstrates how to AppActivate 
 an application that is available from a list of top-level windows. 
 This information applies to Microsoft Visual Basic programming system 
 version 1.0 for Windows. 
 More Information: 
 The task list is generally a subset of the master list. The Windows 
 API functions only support methods of getting the master list, not the 
 task list. However, from the master list you can get a list of all 
 top-level windows closely resembling the task list. The only 
 difference is that the list containing the top-level windows may have 
 more entries than the task list. The reason for this is that it is 
 possible for an application to remove itself from the task list, but 
 it will be included as part of the master list. 
 The example below demonstrates how to get the names of all top-level 
 windows. The names of child windows can also be obtained by calling 
 the GetWindow API function with the GW_CHILD constant. Although the 
 code example only provides an example of using the constants 
 GW_HWNDFIRST and GW_HWNDNEXT as arguments to GetWindow, the value of 
 the other constants such as GW_CHILD are provided in the code. 
 Below are the steps necessary to construct a sample program that 
 demonstrates how to load the task list into a Visual Basic combo 
 box: 
 1. Run Visual Basic, or choose New Project from the File menu (ALT, F, 
    N) if Visual Basic is already running. Form1 will be created by 
    default. 
 2. Change the caption property of Form1 to AppActivate. 
 3. Add the following controls to Form1 and change the CtlNames as 
    indicated in the chart below: 
    Control            Default Name     CtlName 
    -------            ------------     ------- 
    Label Control      Label1           Label1 
    Combo Box          Combo1           Combo_ListItem 
    Command Button     Command1         Command_Ok 
 4. Change the Caption properties of the controls as follows: 
      Control          CtlName          Caption 
      -------          -------          --------- 
      Label Control    Label1           Application to AppActivate: 
      Command Button   Command_OK       OK 
 5. Add the following code to the general declarations section of 
    Form1: 
     DefInt A-Z 
     '* Windows API function declarations 
     Declare Function GetWindow Lib "user" (ByVal hWnd, ByVal wCmd) As 
                                            Integer 
     Declare Function GetWindowText Lib "user" (ByVal hWnd, ByVal 
                                                lpSting$, ByVal 
                                                nMaxCount) As Integer 
     Declare Function GetWindowTextLength Lib "user" (ByVal hWnd) As 
                                                      Integer 
     Const False = 0 
     Const True = Not False 
     '* Declare constants used by GetWindow 
     Const GW_CHILD = 5 
     Const GW_HWNDFIRST = 0 
     Const GW_HWNDLAST = 1 
     Const GW_HWNDNEXT = 2 
     Const GW_HWNDPREV = 3 
     Const GW_OWNER = 4 
 6. Add the following code in the Form_Load event procedure of Form1: 
      Sub Form_Load () 
        Call LoadTaskList 
        '* Check to see if any items are in the task list, if 
        '* not end the program. 
        If Combo_ListItem.ListCount > 0 Then 
            Combo_ListItem.Text = Combo_ListItem.List(0) 
        Else 
            MsgBox "Nothing found in task list", 16, "AppActivate" 
            Unload Form1 
        End If 
      End Sub 
 7. Enter the following code in the Click event procedure of the 
    Command_Ok button: 
      Sub Command_Ok_Click () 
            '* Get the item selected from the text portion of the 
            '* combo box 
            f$ = Combo_ListItem.Text 
            '* Simply resume if an "Illegal function call" occurs on the 
            '* AppActivate statement 
            On Local Error Resume Next 
            AppActivate f$ 
      End Sub 
 8. Enter the following code under the general declarations section of 
    Form1: 
      Sub LoadTaskList () 
            'Get the hWnd of the first item in the master list 
            'so we can process the task list entries (top-level only) 
            CurrWnd = GetWindow(Form1.hWnd, GW_HWNDFIRST) 
            'Loop while the hWnd returned by GetWindow is valid 
            While CurrWnd <> 0 
                '* Get the length of the task name identified by 
                '* CurrWnd in the list 
                Length = GetWindowTextLength(CurrWnd) 
                '* Get the task name of the task in the master list 
                ListItem$ = Space$(Length + 1) 
                Length = GetWindowText(CurrWnd, ListItem$, Length + 1) 
                '* If there is an actual task name in the list, add the 
                '* item to the list 
                If Length > 0 Then 
                    Combo_ListItem.AddItem ListItem$ 
                End If 
                '* Get the next task list item in the master list 
                CurrWnd = GetWindow(CurrWnd, GW_HWNDNEXT) 
                '* Process Windows events 
                x = DoEvents() 
            Wend 
      End Sub 
 9. From the Run menu, choose Start (ALT, R, S) to run the program. 
 From the combo box, select the window title of an application 
 currently running under Windows. Choose the OK button to activate the 
 application. 
 Reference(s): 
 "Programming Windows: the Microsoft Guide to Writing Applications 
 for Windows 3," Charles Petzold, Microsoft Press, 1990 
 "Microsoft Windows Software Development Kit: Reference Volume 1," 
 version 3.0 
 WINSDK.HLP file shipped with Microsoft Windows 3.0 Software 
 Development Kit 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: In VB, Clipboard.SetData Gives "Invalid Format" with Icon 
Document Number: Q78073           Publ Date: 19-NOV-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 If you use a the Visual Basic LoadPicture function to load an icon 
 file (.ICO) into a picture control, then attempt to copy that picture 
 control's picture to the Clipboard using the SetData method, the error 
 message "Invalid Clipboard Format" will be displayed, regardless of 
 the format specified for the SetData method. 
 Microsoft has confirmed this to be a 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: 
 This error will also occur if you attempt to directly load an icon 
 file into the Clipboard using: 
    ClipBoard.SetData LoadPicture("c:\vb\icons\arrows\arw01rt.ico") 
 To work around this problem, set the picture control's Autoredraw 
 property to True (-1) and use the Picture control's Image property in 
 the SetData method rather than the Picture control's picture property. 
 '*** This code will fail with the error "Invalid Clipboard Format" *** 
 Picture1.Picture = LoadPicture("c:\vb\icons\arrows\arw01rt.ico") 
 Clipboard.SetData Picture1.Picture, 2 
 '*** This will avoid the error *** 
 Picture1.Autoredraw = -1 
 Picture1.Picture = LoadPicture("c:\vb\icons\arrows\arw01rt.ico") 
 Clipboard.SetData Picture1.Image, 2 
 '*** This will also work *** 
 Picture1.Picture = LoadPicture("c:\vb\icons\arrows\arw01rt.ico") 
 Picture1.Picture = Picture1.Image 
 Clipboard.SetData Picture1.Picture, 2 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: Sales Specification for Visual Basic Available 
Document Number: Q77906           Publ Date:  2-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 You can obtain the following detailed sales literature by calling 
 Microsoft End User Sales at (800) 426-9400: 
  - Visual Basic, Sales Specification (part number 098-22158) 
  - VB Library for SQL Server, Sales Specification 
 This information applies to Microsoft Visual Basic programming system 
 version 1.0 for Windows. 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: Breakpoint in LostFocus Event Procedure Can Hang VB.EXE 
Document Number: Q77927           Publ Date:  2-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 Placing a breakpoint in a control's LostFocus event procedure can 
 cause the VB.EXE environment to hang under the following conditions: 
  - If there is also a breakpoint in an event procedure for a second 
    control that will be executed when the focus is transferred from 
    the first control (with the breakpoint in its LostFocus event) to 
    the second control 
  - If you transfer focus from the first control to the second control 
    and continue executing the program after encountering the 
    breakpoint in the second control's code 
 Microsoft has confirmed this to be a problem with Microsoft Visual 
 Basic programming system 1.0 for Windows. We are researching the 
 problem and will post new information here as it becomes available. 
 More Information: 
 Steps to Reproduce Problem 
 -------------------------- 
 1. Start Visual Basic (or choose New Project from the File menu). 
 2. Create two command buttons, Command1 and Command2, on Form1. 
 3. Add the following code to the LostFocus event for Command1: 
         Sub Command1_LostFocus 
                 x = 1 
         End Sub 
 4. Place the cursor on the statement "x = 1," and press F9 to place a 
    breakpoint. 
 5. Add the following code to the Click event procedure for Command2: 
         Sub Command2_Click 
                 x = 1 
         End Sub 
 6. Place a breakpoint on the "x = 1" line in Command2_Click. 
 7. Press F5 to execute the program. Click on Command2; this should stop 
    the program at the breakpoint in Command2_Click. Press F5 to 
    continue; the Visual Basic title bar will flash, the cursor will 
    change to an hour glass, and the system will be locked, requiring a 
    reboot. 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: CTRL+LEFT/RIGHT ARROW Different in Editor vs. Immediate Window 
Document Number: Q77928           Publ Date:  2-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 The key combinations CTRL+LEFT ARROW and CTRL+RIGHT ARROW work 
 differently when editing code in a procedure than when typing in the 
 Immediate window. 
 In the Immediate window, CTRL+LEFT ARROW will move the cursor in front 
 of the preceding word even if that word is one of the following 
 symbols: 
    ! @ # $ % ^ ^ & * ( ) { } : ; , " ' [ | < > 
 In the code editor, these symbols are not treated as words, therefore 
 the cursor will skip over them when using the ARROW key combinations 
 to position the insertion point. 
 Microsoft has confirmed this to be a problem in the VB.EXE environment 
 in 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: 
 In a code window, using the LEFT ARROW key with the CTRL key held down 
 will move the cursor to the beginning of the preceding word or letter 
 on that line, disregarding any punctuation marks and other symbols 
 (that is, any character obtained by typing a number while holding down 
 the SHIFT key, all punctuation marks, brackets, braces, and single and 
 double quotation marks. 
 In the Immediate window, only the period is not treated as a word 
 and is skipped over when using the CTRL+LEFT ARROW or CTRL+RIGHT 
 ARROW key combination. 
 Steps to Reproduce Problem 
 -------------------------- 
 1. Run Visual Basic. 
 2. From the File menu, select New Project (ALT, N, P). Form1 will be 
    created by default. 
 3. Press F7 or double-click on Form1 to bring up the code window. 
 4. Enter the following code in the Form_Click event procedure of 
    Form1: 
       Sub Form_Click() 
         print "Home." 
       End Sub 
 5. While the cursor is still at the end of the line, press CTRL+LEFT 
    ARROW to move the cursor to the beginning of the previous word. 
    The cursor should move directly in front of the H in Home. 
 6. From the Run menu, choose Start to run the program. 
 7. Press CTRL+BREAK to bring up the Immediate window. 
 8. Type the following in the Immediate window: 
       Print "Home." 
 9. With the cursor at the end of the line, press CTRL+LEFT ARROW key. 
    The insertion point should be directly in front of the last double 
    quotation mark. 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: Nonstandard Icons Can Make Visual Basic Hang or Display UAE 
Document Number: Q78380           Publ Date:  5-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 If you create an icon in other than standard .ICO format and attach 
 that icon to a Visual Basic form as the icon displayed during 
 minimization or pasted directly to the form, then you may get an 
 "Unrecoverable Application Error" (UAE) message or a cold hang. 
 Nonstandard icons can also cause less severe run-time error messages 
 such as "Invalid Picture." The icon will load at design time but cause 
 problems at run-time. 
 Microsoft has confirmed this to be a 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: 
 Icons created with utilities other than IconWorks (even with the 
 Windows Software Development Kit [SDK| Paint utility) can cause 
 problems because they may not conform to the standard .ICO format. The 
 standard .ICO format that Visual Basic supports is a 32-by-32 pixel 
 matrix, which is specified in the icoDIBSize field in the header of 
 the resource file. Because icons are handled as resources, once 
 incorporated into the .EXE file they can actually corrupt the code, 
 leading to a hang during execution or causing Windows to generate a 
 UAE message. 
 Reference(s): 
 "Microsoft Windows Software Development Kit: Reference Volume 2," 
 version 3.0, page 9-2 
 "Microsoft Windows Programmer's Reference," Chapter 9, Microsoft 
 Press, 1990 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: VB Dynamic Drive Control Arrays Don't Get Correct Coordinates 
Document Number: Q77644           Publ Date:  9-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 Setting the Left, Width, or Top coordinate of the first element of a 
 control array of dynamic drive controls then loading a second element 
 of the array will result in the Left, Width, or Top coordinate of the 
 first and second elements being different. This problem occurs when 
 ScaleMode property of the form is set to Twip, Point, Millimeter, 
 Centimeter, or User ScaleMode. The problem does not occur when the 
 ScaleMode property of the form is set to Character, Pixel, or Inch. 
 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. 
 More Information: 
 When the ScaleMode property of the form is set to Character, Pixel, or 
 Inch, the second and subsequent elements of the control array maintain 
 the same coordinates as the first element of the array, as expected. 
 When the ScaleMode of the form is set to Twip, Point, Centimeter, 
 Millimeter, or User, the subsequent elements of the control array of 
 dynamic drive controls will not have the same coordinates as the first 
 element of the array. 
 Steps to Reproduce Problem 
 -------------------------- 
 1. Start Visual Basic. From the File menu, choose New Project 
    (ALT, F, N). 
 2. Place a drive control (Drive1) on a blank form (Form1). 
 3. From the Properties bar, set the Index property of Drive1 to 0 
    (this is the first element of a control array). 
 4. Double-click anywhere on the form to bring up the Form_Click event 
    procedure. 
 5. Add the following code to the Form_Click event procedure of Form1: 
  SUB Form_Click () 
      Drive1(0).Left = 2000      'Set the x coordinate of the first 
                                 'element of the array 
      Load Drive1(1)             'This loads the second element of the 
                                 'control array 
      Print Drive1(0).Left,Drive1(1).Left    'Print the x coordinate 
                                             'of the two elements of 
                                             'the control array 
  End Sub 
 6. From the Run menu, choose Start. 
 7. Click anywhere on the form. 
 The x (left) coordinates of the Drive1(0) and drive Drive1(1) will 
 print directly on the form. 
 Note: The Drive1(0) left coordinate will be 2000, where the Drive1(1) 
 left coordinate is 1995. 
 A similar discrepancy occurs when the ScaleMode property of Form1 is 
 set to Point, Centimeter, Millimeter, or User. 
 Specifying Drive1(0).Width then loading the next control array element 
 results in the same problem. The width of the second element of the 
 array will be slightly different from the first. 
 The Align to Grid feature of the Visual Basic 1.0 programming 
 environment (VB.EXE) does not change the position or size of any of 
 the elements of the control array. 
 This problem does not occur when the ScaleMode property of the form is 
 set to Character, Pixel, or Inch. 
 A workaround for the problem is to set the Left, Top, or Width property 
 of the second control array element equal to the like property of the 
 first control array element. Insert the following code after the Load 
 Drive1(1) statement in step 5 above to work around the problem as 
 follows: 
    Drive1(1).Left = Drive1(0).Left 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: Memory Limits in Visual Basic for Windows 
Document Number: Q72879           Publ Date: 13-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 The following memory limitations apply to Microsoft Visual Basic 
 programming system version 1.0 for Windows. 
 Note: This information only applies when running the retail version of 
 Microsoft Windows version 3.0. Different memory limitations may apply 
 when running Visual Basic under the debug version of Windows provided 
 with the Microsoft Windows Software Development Kit (SDK). 
 More Information: 
 Each Function or Sub procedure can have up to 64K of pseudocode 
 (pcode). 
 Each form, module, and global module gets its own data segment (up to 
 64K in size) for the allocation of all static data, strings, and 
 simple variables (declared in the General section and Sub and Function 
 procedures). 
 Each array of any data type gets its own data segment, up to 64K in 
 size. Arrays larger than 64K cause a "subscript out of range" error. 
 Huge arrays (arrays larger than 64K) are not directly supported in 
 Visual Basic, but you can support huge arrays through the use of a 
 Windows dynamic link library (DLL). A separate article discussing 
 support for huge arrays can be found by querying on the following 
 words: 
    huge and array and DLL 
 Note that in the discussion below, each menu item that you design into 
 a Visual Basic program is considered as a separate control. 
 The properties for all controls on a form and the properties of the 
 form itself go into a single data segment limited to 64K bytes, except 
 the following: 
  - List() property of a list box 
  - List() property of a combo box 
  - Text property of a text box 
 The List() property gets its own data segment, limited to 64K bytes, 
 for each list box and combo box. The Text property of a text box has a 
 default size limit of 32K, which can be increased to 64K with a call 
 to a Windows API function. For more information on how to increase the 
 amount of text (from 32K to 64K) that can be entered into a text box, 
 query on the following words: 
    windows and api and sendmessage and textlimit 
 Other memory limits relating to the properties of controls and forms 
 include: 
  - Each item in the List() property can be up to 1K in size; any item 
    over this limit is truncated. 
  - The Caption property of a control can be up to 1K in size, any 
    caption over this limit is truncated. 
  - The Tag property of a control can be up to 32K in size, any tag 
    over 32K causes an "out of memory" error. 
 There is one name-and-symbol table up to 32K in size per form, module, 
 or global module. A name-and-symbol table contains the actual text of 
 Sub function and Sub procedure names, variable names, line numbers, 
 line labels, and an additional 4 bytes overhead for each of these 
 names and symbols. 
 If the 32K size limit is exceeded for a name-and-symbol table, an "out 
 of memory" error will occur. To solve this, break up the form or 
 module into multiple forms or modules. (Note: You cannot do this with 
 the global module; only one global module is allowed. If you exhaust 
 the global module's name-and-symbol table, there is no workaround 
 other than to use shorter variable names.) 
 The stack is 16K in size, with just one stack per application. The 16K 
 stack size cannot be changed. Note that an "out of stack space" error 
 can easily occur when your program uses uncontrolled recursion. 
 If you run Visual Basic on the debug version of Microsoft Windows 
 provided with the Microsoft Windows SDK, all properties (including 
 List() and Text properties) go into a single segment, up to 64K in 
 size per form or module. Other memory management limits may also 
 differ under the debug version of Windows. The debug version of 
 Windows is created by copying a set of dynamic link library (DLL) 
 files from the Windows SDK into your \WINDOWS\SYSTEM subdirectory. 
 These special DLLs perform additional error checking, including a 
 check for stack overflow. 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: Restart in VB Break Mode if Delete Blank Line Above End Sub 
Document Number: Q78074           Publ Date: 13-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 Deleting a blank line above the End Sub/End Function or below the 
 Sub/Function statement will generate the message 
    You will have to restart your program 
    after this edit--proceed anyway? 
 while in break mode in the VB.EXE environment. This behavior is by 
 design. 
 This information applies to Microsoft Visual Basic programming system 
 1.0 for Windows. 
 More Information: 
 Deleting the line following the Sub or Function statement requires you 
 to restart when in break mode. This also occurs when deleting the line 
 preceding the End Sub or End Function statement of any procedure. The 
 Visual Basic edit manager treats both of these deletions as 
 modifications to the first or last lines, both of which require a 
 restart when in break mode. 
 The following steps will force a restart in a program while in 
 break mode. 
 1. In a new project, choose Start from the Run Menu. 
 2. Press CTRL+BREAK to suspend execution of the application and enter 
    break mode. 
 3. Press F7, or from the Code menu, choose View Code to bring up the 
    code window. 
 4. The text cursor should be on the blank line between the following 
    procedure statements: 
       Sub Form_Click () 
       End Sub 
 5. Press DEL to delete the blank line between the Sub Form_Click() and 
    End Sub lines. 
    The following message will be displayed: 
       You will have to restart your program 
       after this edit--proceed anyway? 
 The above message is also displayed when the cursor is on the second 
 line and you press the BACKSPACE key once, or if the cursor is at the 
 beginning of the last line of a procedure (at the beginning of the End 
 Sub line) and you press the BACKSPACE key once. 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: "Printer Error" Printing VB Form to Text-Only Printer 
Document Number: Q78075           Publ Date: 13-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 The message "Printer Error" is displayed when you print a form from 
 Visual Basic to a text-only printer. The text-only printer does not 
 have the graphics capability to print the Visual Basic form, and 
 Windows 3.0 traps the printer error and displays the "Printer Error" 
 dialog box. This behavior is by design. 
 This information applies to Microsoft Visual Basic programming system 
 version 1.0 for Windows. 
 More Information: 
 Steps to Reproduce Problem 
 -------------------------- 
 1. From the Windows Control Panel, choose the Printers icon, and 
    select Generic Text / Text Only  as the default printer. (You may 
    need to install the Generic / Text Only printer from the Control 
    Panel to make this option available.) 
 2. Start Visual Basic. 
 3. From the File menu, choose Print. The current form and code 
    are selected by default in the print dialog box. 
 4. Choose the OK button to print. Windows 3.0 displays the "Printer 
    Error" dialog box. 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: How to Sub-Class a VB Form Using VB CDK Custom Control 
Document Number: Q78398           Publ Date: 13-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 In Windows programming terms, sub-classing is the process of creating 
 a message handling procedure and intercepting messages for a given 
 window, handling any messages you choose, and passing the rest to the 
 window's original message handler. 
 The sub-class procedure is basically a message filter that performs 
 non-default processing for a few key messages, and passes other 
 messages to a default window procedure using CallWindowProc(). The 
 CallWindowProc() function passes a message to the Windows system, 
 which in turns sends the message to the target window procedure. The 
 target window procedure cannot be called directly by the sub-class 
 procedure because the target procedure (in this case a window 
 procedure) is exported. 
 Below is a simple example of how to sub-class a Visual Basic form by 
 writing a custom control using the Visual Basic Control Development 
 Kit (CDK). 
 This information applies to Microsoft Visual Basic programming system 
 version 1.0 for Windows. 
 More Information: 
 The following code example demonstrates how to sub-class a form from a 
 custom control using the Visual Basic Custom CDK. The CDK (kit number 
 046-050-022), can be obtained by calling Microsoft End User Sales at 
 (800) 426-9400. 
 This example is developed using the CIRCLE.C program example from the 
 CIRCLE1 project supplied with the CDK package. Only the file(s) that 
 have changed from this project are included, and it is assumed that 
 you have the additional CDK files as well as a C compiler capable of 
 creating a Windows 3.0 compatible dynamic link library (DLL). 
 The basic idea for sub-classing is to examine the window structure for 
 a window directly using GetWindowLong to determine the address of the 
 original window procedure. You can then change the address of the 
 target window's window procedure to the address of your sub-class 
 procedure using SetWindowLong. In your sub-class window procedure, you 
 handle the messages you wish and use CallWindowProc to pass along 
 other messages to the original window procedure. 
 //=================== CIRCLE1 ================== 
 // CIRCLE.C 
 // An example of sub-classing a Visual Basic Form 
 //============================================== 
 #define  NOCOMM 
 #include <windows.h> 
 #include <vbapi.h> 
 #include "circle.h" 
 //declare the subclass procedure 
 LONG FAR PASCAL _export SbClsProc(HWND,USHORT,USHORT,LONG); 
 //far pointer to the default procedure 
 FARPROC lpfnOldProc = (FARPROC) NULL ; 
 //get the controls parent handle(form1) 
 HWND    hParent ; 
 //---------------------------------------------------------- 
 // Circle Control Procedure 
 //---------------------------------------------------------- 
 LONG FAR PASCAL _export CircleCtlProc (HCTL hctl, HWND hwnd, 
      USHORT msg, USHORT wp, LONG lp) 
 { 
    LONG lResult ; 
    switch (msg) 
    { 
       case WM_CREATE: 
          switch (VBGetMode()) 
          { 
             //this will only be processed during run mode 
             case MODE_RUN: 
             { 
                hParent = GetParent (hwnd) ; 
                //get the address instance to normal proc 
                lpfnOldProc = (FARPROC) GetWindowLong 
                               (hParent, GWL_WNDPROC) ; 
                //reset the address instance to the new proc 
                SetWindowLong (hParent, 
                         GWL_WNDPROC, (LONG) SbClsProc) ; 
             } 
             break ; 
          } 
          break ; 
    } 
    // call the default VB proc 
    lResult = VBDefControlProc(hctl, hwnd, msg, wp, lp); 
    return lResult; 
 } 
 LONG FAR PASCAL _export SbClsProc (HWND hwnd, USHORT msg, 
      USHORT wp, LONG lp) 
 { 
    switch (msg) 
    { 
       case WM_SIZE: 
       { 
       //place size event here for example... 
       } 
       break; 
       case WM_DESTROY: 
          SetWindowLong (hwnd, GWL_WNDPROC, 
                         (LONG) lpfnOldProc) ; 
       break ; 
    } 
    // call CircleCtlProc to process any other messages 
    return (CallWindowProc(lpfnOldProc, hwnd, msg, wp, lp)); 
 } 
 ;========================================================== 
 ;Circle.def - module definition file for CIRCLE3.VBX control 
 ;========================================================== 
 LIBRARY         CIRCLE 
 EXETYPE         WINDOWS 
 DESCRIPTION     'Visual Basic Circle Custom Control' 
 CODE            MOVEABLE 
 DATA            MOVEABLE SINGLE 
 HEAPSIZE        1024 
 EXPORTS 
            WEP       @1 RESIDENTNAME 
            SbClsProc @2 
 ;------------------------------------------------------ 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: VB CDK Custom Property Name Cannot Start with Numeric 
Document Number: Q78399           Publ Date: 13-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 The Property Name (npszName) field in the PROPINFO structure for the 
 Visual Basic Control Development Kit (CDK) cannot start with a numeric 
 value. 
 This information needs to be added to page 132 of the "Microsoft 
 Visual Basic: Control Development Guide" add-on for Microsoft Visual 
 Basic programming system version 1.0 for Windows. 
 More Information: 
 When a controls property starts with a numeric value, Visual Basic 
 will generate the binding/syntax checking error "Expected: 
 end-of-statement". However, the property works correctly in the Visual 
 Basic [design| mode from the property bar. 
 Steps to Reproduce Problem 
 -------------------------- 
 To reproduce the error message, do the following: 
 1. Rebuild the Circle3 example provided with the CDK after changing 
    the PROPINFO Property_FlashColor structure in Circle3.h to the 
    following: 
    PROPINFO Property_FlashColor = 
    { 
    "2FlashColor", DT_COLOR ] PF_fGetData ] PF_fSetData ] 
    PF_fSaveData ] PF_fEditable, OFFSETIN(CIRCLE, 
    FlashColor) 
    } ; 
 2. While in Visual Basic development environment (VB.EXE) with the 
    Circle3 control loaded, assign the 2FlashColor a value. 
       Circle1.2FlashColor = 2 
 3. Press F5 to generate the "Expected: end-of-statement" error 
    message. The text "FlashColor" will be selected for the syntax 
    error. 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: No New Timer Events During Visual Basic Timer Event Processing 
Document Number: Q78599           Publ Date: 13-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 Timer controls can be used to automatically generate an event at 
 predefined intervals. This interval is specified in milliseconds, and 
 can range from 0 to 64767 inclusive. 
 Timer event processing will not be interrupted by new timer events. 
 This is because of the way that Windows notifies an application that a 
 timer event has occurred. Instead of interrupting the application, 
 Windows places a WM_TIMER message in it's message queue. If there is 
 already WM_TIMER message in the queue from the same timer, the new 
 message will be consolidated with the old one. 
 After the application has completed processing the current timer 
 event, it checks it's message queue for any new messages. This queue 
 may have new WM_TIMER messages to process. There is no way to tell if 
 any WM_TIMER messages have been consolidated. 
 This information applies to Microsoft Visual Basic programming system 
 version 1.0 for Windows. 
 Reference(s): 
 "Programming Windows: The Microsoft Guide to writing applications for 
 Windows 3.0," Charles Petzold, Microsoft Press, 1990 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: DEL Key Behavior Depends on Text Box MultiLine Property 
Document Number: Q77737           Publ Date: 16-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 Pressing the DEL key in a multiline text box generates a KeyPress 
 event for that text box with an ASCII code of 8 for the key. In a 
 standard text box, no KeyPress event is generated for the DEL key. 
 This behavior is inherent to Windows 3.0 and is not specific to 
 Microsoft Visual Basic. 
 This information applies to Microsoft Visual Basic programming system 
 version 1.0 for Windows. 
 More Information: 
 Steps to Reproduce Problem 
 -------------------------- 
 1. Place a text box on a form. 
 2. Set the MultiLine property for the text box to True. 
 3. Add the following code to the text box KeyPress event: 
    Sub Text1_KeyPress (keyAscii as Integer) 
         debug.print keyAscii  'This will print the generated ASCII 
                               'code to VB's Immediate window 
    End Sub 
 4. Execute the program and press the DEL key while the focus is on the 
    text box. An "8" will be printed in the Immediate window. 
 If the text box's MultiLine property is set to false, no KeyPress 
 event occurs and nothing is printed to the Immediate window when you 
 press the DEL key. This behavior is standard for Windows multiline 
 text boxes. 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: VB Can Call Escape API to Specify Number of Copies to Printer 
Document Number: Q78165           Publ Date: 27-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 You can call the Windows API Escape function to tell the Windows Print 
 Manager how many copies of a document you want to print. 
 This information applies to Microsoft Visual Basic programming system 
 version 1.0 for Windows. 
 More Information: 
 The Windows API constant SETCOPYCOUNT (value 17) can be used as an 
 argument to the Escape function to specify the number of uncollated 
 copies of each page for the printer to print. 
 The arguments for Escape are as follows: 
 r% = Escape(hDC, SETCOPYCOUNT, Len(Integer), lpNumCopies, lpActualCopies) 
 Parameter          Type/Description 
 ----------         ---------------- 
 hDC                hDC. Identifies the device context. Usually 
                    referenced by Printer.hDC. 
 lpNumCopies        Long pointer to integer (not ByVal). Point to a 
                    short-integer value that contains the number of 
                    uncollated copies to print. 
 lpActualCopies     Long pointer to integer (not ByVal). Points to a 
                    short integer value that will receive the number of 
                    copies that where printed. This may be less than 
                    the number requested if the requested number is 
                    greater than the device's maximum copy count. 
 The return value specifies the outcome of the escape. It is 1 if the 
 escape is successful; it is a negative number if the escape is not 
 successful. If the escape is not supported, the return value is zero. 
 The following sample will demonstrate how to print three copies of a 
 line of text to the printer. To recreate this example, create a new 
 project from the Visual Basic File menu and add a command button. 
 Paste the following code into the appropriate code sections of your 
 program: 
 REM   Below is GLOBAL.BAS: 
 'Note: the following Declare must be on one line: 
 Declare Function Escape% Lib "GDI" ( 
         ByVal hDc%, 
         ByVal nEsc%, 
         ByVal nLen%, 
         lpData%, 
         lpOut%) 
 REM   Below is the click procedure for a command button on FORM1: 
 Sub Command1_Click () 
   Const SETCOPYCOUNT = 17 
   Const NULL = 0& 
      Printer.Print "" 
      x% = Escape(Printer.hDC, SETCOPYCOUNT, Len(I%), 0, 3) 
      Printer.Print " Printing three copies of this" 
      Printer.EndDoc 
 End Sub 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: "Out of Memory" May Lead to Unstable Visual Basic Environment 
Document Number: Q78774           Publ Date: 27-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 Once an "Out of Memory" error occurs in a session in the Visual Basic 
 development environment (VB.EXE), subsequent operations may be 
 affected. Repeated alert message boxes may appear during the session, 
 primarily the "Out of Memory" error message, but other errors may 
 occur in unexpected sequence. 
 Generally, the best solution is to exit the environment completely and 
 then re-enter to a new session. Continued operations after the 
 environment becomes unstable can lead to an "Unrecoverable Application 
 Error" (UAE) message, and can possibly cause a system hang. 
 Microsoft is researching this problem and will post new information 
 here as it becomes available. 
 This information applies to Microsoft Visual Basic programming system 
 version 1.0 for Windows. 
 More Information: 
 Steps to Reproduce Problem 
 -------------------------- 
 1. Load a text file into the Global Module (such as the WINAPI.TXT 
    file that accompanies the Windows Programmer's Guide and 
    Online Resource) that exceeds the 64 K data segment size of the 
    Global Module. 
 2. From the Code menu, choose Load Text. In the subsequent dialog box, 
    select an oversize text file and press ENTER. 
 3. When the "Out of Memory" message is displayed, choose OK in the 
    alert box. 
 4. From the File menu, choose New Form or New Module. 
 5. Another "Out of Memory" message is displayed, followed by a another 
    message that Visual Basic is "Out of Memory." 
 6. Choose OK and attempt to open a file. 
 Another "Out of Memory" error will occur, and the file will not load 
 completely. The environment is corrupted and in an unstable state. At 
 this point, the only solution is to exit Visual Basic. 
 Reference(s): 
 "Microsoft Windows Programmer's Book and Online Resource," Visual 
 Basic add-on kit number 1-55615-413-5 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: Incorrect Jumps in Visual Basic Online Help "How To" Section 
Document Number: Q78895           Publ Date: 27-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 In the Visual Basic online Help, under the How To option, under the 
 Graphics topic, there are two incorrect jumps. If you select the 
 Displaying Graphics at Run Time or Displaying Graphics on a Form 
 topic, online Help will jump to an incorrect Help screen. 
 Microsoft has confirmed this to be 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: 
 Workaround 
 ---------- 
 For online Help with either of these topics, do the following: 
 1. From the Help menu, choose Index. 
 2. Choose the Search button. 
 3. Type the word "graphics," or scroll down the list to the graphics 
    topic. 
 4. Choose the Show Topics button. 
 5. The Displaying Graphics on a Form and Displaying Graphics at Run 
    Time topics will both appear in the Go To list box. If you select 
    either of these topics, Help will display the correct screen. 
 Steps to Reproduce Problem 
 -------------------------- 
 1. From the Visual Basic (VB.EXE) Help menu, choose Index. 
 2. Choose the How To option. 
 3. Scroll down to the Graphics topic. 
 4. Select the Displaying Graphics at Run Time topic or the 
    Displaying Graphics on a Form topic. 
 When selected, both of these topics jump to the wrong Help screens. 
 Selecting the Displaying Graphics at Run Time option will bring you to 
 the Adding and Deleting Menu Commands at Runtime screen. Selecting the 
 Displaying Graphics on a Form option will take you to the Displaying 
 Graphics at Run Time screen. 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: VB SETUP.EXE "Insufficient Disk Space on: C:\WINDOWS" 
Document Number: Q78961           Publ Date: 27-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 Visual Basic will display the message 
    Error - Insufficient disk space on: C:\WINDOWS 
 during setup if there is less than 330K of space available to Windows 
 on the drive where Windows resides, which may be different than the 
 drive on which you are installing Visual Basic. 
 This information applies to Microsoft Visual Basic programming system 
 version 1.0 for Windows. 
 More Information: 
 At the beginning, SETUP.EXE for Visual Basic copies the files 
 VBSETUP.EXE and VBRUN100.DLL (approximately 55K and 272K bytes, 
 respectively) into the Windows subdirectory. If there is not enough 
 space on the drive where Windows resides (such as in C:\WINDOWS), 
 Visual Basic will display the "Error - Insufficient disk space on: 
 C:\WINDOWS" message. 
 This is the disk space available to Windows just before setup. This 
 may differ from the amount of space reported at the MS-DOS command 
 prompt outside of Windows because of temporary files that Windows 
 creates during operation. 
 VBSETUP.EXE is deleted when setup is completed. VBRUN100.DLL is copied 
 over to the Visual Basic subdirectory, but is not deleted from the 
 Windows subdirectory. 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: List of Visual Basic Third-Party Add-On Products Available 
Document Number: Q78962           Publ Date: 27-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 A file is available that lists Visual Basic third-party add-on 
 products as of November 22, 1991. This file can be found in the 
 Software/Data Library by searching on the word VBADDONS, the Q number 
 of this article, or S13242. VBADDONS was archived using the PKware 
 file-compression utility. 
 This information applies to Microsoft Visual Basic programming system 
 version 1.0 for Windows. 
 The VBADDONS file contains the following sections: 
  - Custom controls and .DLLs 
  - Data access/connectivity 
  - Graphics utilities and clip-art 
  - Publications and services 
  - Trademarks 
  - Where to send additions or corrections 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: Visual Basic List Box Won't Open if Resized at Run Time 
Document Number: Q79030           Publ Date: 27-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 When you click the down arrow of the drive list box control, the drive 
 list box will not open if it has been resized at run time. The Width 
 property is Read/Write at run time. However, if it is changed at run 
 time, the drive list box won't open. This is true even if it is 
 restored to its original value before attempting to open it. 
 Microsoft has confirmed this to be a problem in Visual Basic 
 programming system version 1.0 for Windows. We are researching this 
 problem and will post new information here as it becomes available. 
 Note also that page 11 of the "Microsoft Visual Basic: Language 
 Reference" incorrectly lists the Height property of the drive list box 
 as being Read/Write at run time, but Height is actually Read-Only at 
 run time. 
 More Information: 
 Note: Neither the directory list box nor the file list box are 
 affected by run-time resizing. 
 Steps to Reproduce Problem 
 -------------------------- 
 1. Click on the drive list box control icon on the Toolbox. Draw a 
    drive list box on the form. Resize the drive list box to any size 
    you desire. At run time, the drive list box will correctly open 
    when you click the down arrow. 
 2. Create three command buttons on the form. Caption them "Narrow," 
    "Wider," and "Restore." 
 3. Insert the following code: 
    Note: The example assumes a starting dimension of 2055 wide (user 
    alterable) by 315 high (the standard height in twips). 
    Sub Command1_Click () 
    drive1.WIDTH = 1025             ' Narrow 
    End Sub 
    Sub Command2_Click () 
    drive1.WIDTH = 4110             'Wider 
    End Sub 
    Sub Command3_Click () 
    drive1.WIDTH = 2055             'Restore 
    End Sub 
 4. Run the example. 
 5. Open the drive list box. Click on Narrow or Wider. 
 6. Try to open the drive list box again. It fails to open. 
 7. Click Restore. Again try to open the drive list box. It fails to 
    open. 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: Visual Basic Code Window Hides Split View if Resized 
Document Number: Q79057           Publ Date: 27-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 The Visual Basic development environment (VB.EXE) behaves unexpectedly 
 when a split Code window is resized. Instead of proportionally 
 resizing the two sub-windows along with the parent window, the lower 
 split view is obscured. The only indication that a split window is in 
 effect is that both the horizontal scroll bar and the bottom of the 
 vertical scroll bar are also obscured. 
 Microsoft has confirmed this to be a problem in 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: 
 Workaround 
 ---------- 
 To work around this problem, resize the Code window to a convenient 
 size before splitting the window. 
 Steps to Reproduce Problem 
 -------------------------- 
 1. Open a Code window. 
 2. Create a split Code window by placing the cursor between the Code 
    window header and the top of the Code window and dragging downward. 
 3. Resize the Code window to a smaller size (whether from the top down 
    or from the bottom up). 
 The result is that the lower window is hidden, including any break 
 points you were trying to track (for example, while watching one set 
 in each window). 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: In VB, Format$ Using # for Digit Affects Right Justification 
Document Number: Q79094           Publ Date: 27-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 The pound (#) sign does not serve as a place holder for blank spaces 
 when used with the Format$ function to reformat numbers as strings. If 
 a pound sign place holder is not filled by a digit, Format$ truncates 
 that digit position and will not replace that position with a space. 
 This may be undesirable behavior if you are attempting to right 
 justify the numeric digits within the string. This behavior is by 
 design. 
 The pound sign (#) place holder is handled differently between the 
 Visual Basic Format$ function and the Print Using statement found in 
 other Basic products. In the case of the Print Using statement, a 
 pound sign place holder is replaced by a space when no numeric digit 
 occupies that position. By using the Print Using statement, you can 
 right justify a formatted numeric string using the pound sign as place 
 holders for the number. Note that Visual Basic does not support the 
 Print Using statement. Additional code is needed to right justify a 
 string using the Format$ function. An example is given further below. 
 This information applies to Microsoft Visual Basic programming system 
 version 1.0 for Windows. 
 More Information: 
 Page 121 of the "Microsoft Visual Basic: Language Reference" for 
 version 1.0 regarding the Format$ function is unclear on how the pound 
 sign is handled. When there is no numeric digit to fill the pound sign 
 place holder, the manual does not clarify whether the pound sign is 
 replaced by a space or truncated. The documentation should be changed 
 to reflect how the pound sign is handled by the Format$ function. 
 The Print Using statement supported in other Basic products allows the 
 use of the pound sign as a place holder for leading or trailing 
 spaces, as follows: 
    Print Using "##0.00"; myvar 
 The above example will cause two leading spaces to be added to the 
 resulting string representation of the variable myvar when the value 
 of myvar is printed to the screen. 
 When used with the Visual Basic Format$ function, the same pound sign 
 format switch (#) does not work as a placeholder for spaces: 
    mystring$ = Format$(myvar , " ##.## ") 
 The Visual Basic Format$ function yields a formatted string 
 representation of myvar with no leading spaces. This may not be the 
 result you expected (for example, when myvar = 1.23). You may have 
 expected the formatted result to have one leading space allowing you 
 to right justify the number, but no leading space is added. 
 The following code sample will produce an output of right aligned 
 numbers in QuickBasic version 4.5. 
    a = 1.23 
    b = 44.56 
    Print Using "##.##"; a 
    Print Using "##.##"; b 
 The following code sample will produce an output of left aligned 
 numbers in Visual Basic: 
    Sub Form_Click () 
            a = 1.23 
            b = 44.56 
            num1$ = Format$(a, "##.##") 
            num2$ = Format$(b, "##.##") 
            Print num1$ 
            Print num2$ 
    End Sub 
 Click on the form to print the numbers. These numbers will be left 
 aligned, instead of right aligned as may be desired. 
 A workaround is to use a monospaced font, such as Courier, and use the 
 Len function to determine how many spaces need to be added to the left 
 of the string representation of the number in order to right align the 
 result. 
 Workaround 
 ---------- 
     Sub Form_Click () 
         desired = 5   'longest number expected 
         a = 1.23 
         b = 44.56 
         FontName = "Courier"   'Select a fixed-spaced font 
         num1$ = Format$(a, "#0.00")  'This converts number to a string 
         num2$ = Format$(b, "#0.00")  '2 decimal places and a leading 0 
         If (desired - Len(num1$)) > 0 Then 
             num1$ = Space$(desired - Len(num1$)) + num1$ 
         End If 
         If (desired - Len(num2$)) > 0 Then 
             num2$ = Space$(desired - Len(num2$)) + num1$ 
         End If 
         Print num1$ 
         Print num2$ 
     End Sub 
 Additional reference words: 1.00 4.50 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: VB "Illegal Function Call" Under Windows Low Memory Condition 
Document Number: Q79097           Publ Date: 27-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 Under extremely low memory conditions in Windows, Visual Basic may 
 generate an "Illegal function call" error message even though there is 
 no error in the code. 
 This information applies to the Microsoft Visual Basic programming 
 system version 1.0 for Windows. 
 More Information: 
 Workaround 
 ---------- 
 To avoid the "Illegal function call" error, free some memory by 
 closing other Windows applications. 
 Steps to Reproduce Problem 
 -------------------------- 
 When Windows system memory resources are nearly exhausted, you can 
 perform the following steps to reproduce the error: 
 1. Start Visual Basic. 
 2. From the Run menu, choose Start (ALT, R, S). 
 3. From the Run menu, choose Break (ALT, R, K). 
 4. From the Window menu, choose Immediate Window (ALT, W, I). 
 5. Enter the following code in the Immediate window: 
       MsgBox "hi" 
 If memory is sufficiently low, an "Illegal function call" error 
 message will be displayed. 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: VB Multiline Text Box Memory Not Freed when Form Is Unloaded 
Document Number: Q79115           Publ Date: 27-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 Repeatedly loading and unloading a multiline text box in a Microsoft 
 Visual Basic program will result in a loss of memory proportional to 
 the amount of text in the text box for each unload. This memory is not 
 recovered until you terminate the Visual Basic environment (if running 
 under the VB.EXE environment), or end your compiled program (if 
 running a compiled .EXE). With large amounts of text or many 
 iterations of loading and unloading, an "Out of Memory" error can 
 occur. 
 This problem only occurs when the form is loaded and then unloaded. 
 Hiding a form containing a multiline text box will not result in a 
 loss of memory. This problem does not occur with a single line text 
 box. 
 Microsoft has confirmed this to be a problem with 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: 
 Steps to Reproduce Problem 
 -------------------------- 
 1. Start Visual Basic or from the File menu, choose New Project. 
 2. From the File menu, choose New Form to add a second form to the 
    project. 
 3. Create a text box named "Text1" on Form2. Set the Text1 MultiLine 
    property to True. 
 4. Add the following code to Form1: 
      Sub Form_Click 
        Form2.Show 
      End Sub 
 5. Add the following code to Form2: 
      Sub Form_Load 
        Open "<any text file>" For Input As #1 
        While Not Eof(1) 
          Input #1, a$ 
          b$ = b$ + Chr$(13) + Chr$(10) + a$ 
        Wend 
        Close 
        Text1.Text = b$ 
      End Sub 
      Sub Form_Click 
        Unload Form2 
      End Sub 
 6. Run the program. In the Windows Program Manager, from the Help 
    menu, choose About Program Manager to check free memory. 
 7. Click Form1; Form2 will load and display the text from the text 
    file. 
 8. Click Form2 to unload Form2; focus should return to Form1. Go to 
    Program Manager and check free memory again - the result is a loss 
    of memory proportional to the amount of text in the multiline text 
    box. 
 Showing and unloading Form2 will continue to use memory each time it 
 is performed. The lost memory is not recovered until you completely 
 exit VB.EXE or terminate your compiled Visual Basic application. This 
 problem does not occur when using a single line text box. 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: VB Extra Resize Event when WindowState Not Normal (Not 0) 
Document Number: Q79116           Publ Date: 27-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 An extra Resize event will occur when a Visual Basic form is unloaded 
 if that form's WindowState property is set to either 1 (Minimized) or 
 2 (Maximized). 
 Microsoft has confirmed this to problem with 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: 
 Workaround 
 ---------- 
 To avoid performing code in the Form_Resize event for this extra 
 Resize event, you can set a global variable in the form's Unload event 
 procedure that you can check in the Resize event procedure to 
 determine if a normal Resize or an extra Resize event is occurring. 
 To work around this problem, add the following code to the program: 
 1. Dimension a flag variable in the General - Declarations section of 
    the form in question: 
       Dim ExtraEventFlag% 
 2. Set the flag in the Form_Unload event: 
         Sub Form_Unload (Cancel as Integer) 
           ExtraEventFlag% = -1 
         End Sub 
 3. Check the flag variable's value before performing code in the 
    Resize event: 
         Sub Form_Resize 
           If Not ExtraEventFlag% Then 
                 Beep    '** or other code for the Resize event.. 
           End If 
         End Sub 
 The Form_Unload event should occur before the Form_Resize event, set 
 the flag variable, and prevent the code for the Resize event from 
 executing for this extra event. 
 Steps to Reproduce Problem 
 -------------------------- 
 1. Start Visual Basic, or from the File menu, choose New Project. 
 2. In Form_Resize, add a Beep statement. 
 3. Set Form1.WindowState = 1 (Minimized). 
 4. Run the program. One beep occurs, and the minimized icon appears at 
    the bottom of the screen. 
 5. Double-click the icon to restore the form. A beep sounds, 
    indicating that a resize event has occurred. 
 6. Double-click the system menu of Form1 to close the form. Another 
    beep sounds, indicating that a resize event has occurred. 
 For forms with a Normal WindowState, no Resize event occurs when you 
 close the form. 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: Text Too Narrow with Italic Fonts in Visual Basic Labels 
Document Number: Q79117           Publ Date: 27-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 When the FontItalic property of a label control is set to True (-1), 
 the text in the caption property is incorrectly formatted into lines 
 that are about half as wide as the label width. 
 When the FontItalic property is set to False (0), the text is 
 correctly formatted so that each line of text correctly occupies the 
 width of the label. 
 Microsoft has confirmed this to be a problem in 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: 
 Workaround 
 ---------- 
 To work around this problem, use any one of the following 
 alternatives: 
  - Make the label wider so that the text appears as desired. 
  - Set the AutoSize property on the label to True (-1). Note that this 
    will format the label caption into one line of text. 
  - Create several labels, one for each line of text. 
  - Set the FontItalic property to False (0). 
 Steps to Reproduce Problem 
 -------------------------- 
 1. Start Visual Basic. From the File menu, choose New Project (ALT, F, 
    N). Form1 will be created by default. 
 2. Place a label (Label1) on Form1. 
 3. Set the label's Caption property to "This is a line of text" 
    (without the quotation marks). 
 4. Make the label just wide enough to display the entire caption on 
    one line. Make the label tall enough to display three or four lines 
    of text. 
 4. Set the FontItalic property to True. The caption is incorrectly 
    formatted as two lines. 
 5. If you further reduce the width of the label, it incorrectly 
    formats the lines to about half the new width of the label. 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: "Invalid Outside Sub," Copy/Paste to VB General Declarations 
Document Number: Q79240           Publ Date: 27-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 An "Invalid outside Sub or Function" error occurs in the VB.EXE 
 environment under the following conditions: 
 1. A Sub or Function is copied to the general Declarations section of 
    a form. 
 2. The name of the Sub or Function copied to the general Declarations 
    section is changed, or the original Sub or Function that was copied 
    is deleted. 
 3. The program is run from the VB.EXE environment. 
 Microsoft has confirmed this to be a 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 problem occurs when you copy a subprogram to the general 
 Declarations section with Sub subname() and End Sub (or Function 
 functionname () ... End Function) included. If you change the name of 
 the original or copied Sub (or Function), the error "Invalid outside 
 Sub or Function" will occur at run time. After the error occurs, the 
 Sub or Function header of the copied Sub will be missing. 
 This problem occurs because the Sub or Function that was changed is 
 treated as the entry of a new procedure. The body of the Sub or 
 Function and the End Sub (or End Function) statement are treated as an 
 existing part of the general Declarations section and are left behind. 
 The behavior is identical when the Sub (or Function) that was copied 
 is deleted. The Sub (or Function) heading of the copy, residing in the 
 general Declarations section, is treated as a new Sub or Function 
 entry. 
 Workaround 
 ---------- 
 1. Select (highlight) the remaining code fragment in the general 
    Declarations section. 
 2. From the Edit menu, choose Cut (ALT, E, T). 
 3. From the Procedure box, choose Test2. 
 4. From the Edit menu, choose Paste to paste the code cut in step 2 
    above into the body of the Test2 subprogram. 
 5. Delete the duplicate End Sub statement. 
 General steps to copy a subprogram and avoid the problem: 
 1. Create a new subprogram (such as Sub Test1). 
 2. Create a second subprogram with a different name (such as Sub 
    Test2). 
 3. Copy just the body of the code from the first subprogram (Test1) 
    into the second subprogram (Test2). 
 Steps to Reproduce Problem 
 -------------------------- 
 1. Run Visual Basic, or from the File menu, choose New Project (ALT, F, 
    N) if Visual Basic is already running. 
 2. Enter the following code in the general Declarations of Form1: 
       Sub Test1 () 
          Print "Hello" 
       End Sub 
 3. Highlight the code for the Sub and press CTRL+INSERT to copy the 
    entire Test1 subprogram. 
 4. Switch to the general Declarations window. 
 5. Paste the code copied in step 3 above by pressing CTRL+INSERT. 
 6. Change the name of the Sub from Test1 to Test2. 
 7. From the Run menu, choose Start (ALT, R, S) to run the program. 
 The error occurs in the general Declarations section on the following 
 code fragment: 
       Print "Hello" 
    End Sub 
 As illustrated above, the first line of the subprogram, Sub Test2 (), 
 is missing. This is because Visual Basic treats the name change as a 
 new Sub entry and established a new subprogram (Test2). The Procedure 
 box will contain Test2 as a subprogram. Visual Basic considers the 
 remaining part of Test2 (the code fragment above) to be an existing 
 part of the general Declarations section. 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: Resetting ListIndex Property Generates Click Event 
Document Number: Q79241           Publ Date: 27-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 Resetting the ListIndex property of a list box, combo box, directory 
 list box, or a file list box at run time generates a Click event for 
 the control. For a drive list box, resetting the ListIndex property 
 generates a Change event. 
 This is a result of the Windows subclass definition for these 
 controls. When an item in one of these list boxes is selected, a Click 
 event (or Change event for drive list box) occurs and the ListIndex 
 property is updated. Conversely, when the ListIndex property is 
 changed, a message occurs, generating the corresponding event. 
 This behavior is not documented in the Visual Basic documentation or 
 online Help. 
 This information applies to the Microsoft Visual Basic programming 
 system version 1.0 for Windows. 
 More Information: 
 This undocumented behavior can cause some unexpected results. For 
 example, if code in a Click (or Change) event procedure is assigning 
 the selected items in the list box to an array or directly to the Text 
 property of another control, resetting the ListIndex property will 
 cause another such assignment, but with the new item. 
 If the ListIndex is reset to -1, a null item will be assigned by the 
 code because that setting indicates no item is selected. 
 To demonstrate this behavior, do the following: 
 1. Run Visual Basic, or from the File menu, choose New Project if 
    Visual Basic is already running. Form1 will be created by default. 
 2. Put a combo box (Combo1) on Form1. 
 3. Add a text box (Text1) to Form1. 
 4. Add a command button (Command1) to Form1. 
 5. Add the following code to the Click event for the list box chosen: 
      Sub Combo1_Click () 
           text1.text = combo1.text 
      End Sub 
 Note: For drive and directory list boxes, the assignment would be 
    text1.text=drive1.list(drive1.ListIndex) 
 -or- 
    text1.text=dir1.list(dir1.ListIndex) 
 Add the following code to the Click event procedure for Command1: 
    Sub Command1_Click () 
         combo1.ListIndex = -1 
    End Sub 
 Add the following code to the Form_Load event procedure of Form1: 
    Sub Form_Load () 
         For n = 1 To 10 
              combo1.AddItem Format$(n, "0") 
         Next 
    End Sub 
 Run the program. Notice that when the Command1 button is pressed, the 
 list box is updated as expected, the code in the Click event procedure 
 for the list box is executed, and the Text property of the text box is 
 changed. 
 Reference(s): 
 "Programming Windows: the Microsoft Guide to Writing Applications for 
 Windows 3," by Charles Petzold, Microsoft Press, 1990 
 "Microsoft Windows Software Development Kit: Reference Volume 1," 
 version 3.0 
 WINSDK.HLP file shipped with Microsoft Windows 3.0 Software 
 Development Kit 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: Property Values Incorrect for a Maximized Form in VB 
Document Number: Q79242           Publ Date: 27-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 The Top, Left, ScaleHeight, and ScaleWidth properties of a maximized 
 Visual Basic form may return incorrect values. When a form is 
 maximized, the values returned by these properties should be close to 
 the resolution of your monitor. The only difference between the 
 property values returned and the resolution should be due to 
 BorderStyles, menus, or title bars, and should in no case be greater 
 than the resolution of your monitor. 
 In some cases, with a maximized form, the returned property values can 
 be greater than the screen resolution. This is because of a problem in 
 the Windows API routine, GetClientRect(), which Visual Basic calls to 
 get the form properties. This is a problem with Windows 3.0, not with 
 Visual Basic. 
 This information applies to the Microsoft Visual Basic programming 
 system version 1.0 for Windows. 
 More Information: 
 The Left property determines the distance between the internal left 
 edge of an object and the left edge of its container. 
 The Top property determines the distance between the internal top edge 
 of an object and the top edge of its container. 
 ScaleHeight sets or returns the range of the vertical axes for an 
 object's internal coordinate system, and ScaleWidth sets or returns 
 the horizontal axes. On a form, the coordinate system includes the 
 form's internal area, not including borders and title bar. 
 Example 
 ------- 
 To duplicate the problem, experiment with various BorderStyles, 
 set ScaleMode to pixels, and add the following code: 
    Sub Form_Click() 
      Print Left,Top ,ScaleWidth,ScaleHeight 
    End Sub 
 Run the application and click on the form, and note the values 
 printed. With no border, the values should correspond to the 
 resolution of your monitor, and should change slightly for each 
 BorderStyle from the addition of borders, menus, and title bars. 
 One example of the problem occurs using the following code in a 
 maximized form using a ScaleMode of 1 (twips) with 800-by-600 (pixel) 
 screen resolution: 
 Sub Form_Click 
    Print "Screen = "; screen.width; ", "; screen.height 
    Print "Form = "; form1.width; ", "; form1.height; 
                     " at "; form1.left; ", "; form1.top 
    Print "------------------------------------------------------- 
 ------------------------" 
 ' Note that each Print statement above must be on just one line. 
 End Sub 
 The results under the above conditions are: 
 Screen = 12000, 9000 
 Form = 12120, 9120 at -60, -60 
 Additional reference words: 1.00 buglist3.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: VB.EXE "Save Text" Overwrite Prompt Can Show Unusual .. Path 
Document Number: Q79258           Publ Date: 27-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 Visual Basic can, under specific conditions, display a save path that 
 is technically correct yet does not conform with other Windows 
 applications, for example: 
    c:\Dir1\SubDir2\..\SubDir1\Form1.TXT 
 Microsoft has confirmed this to be a problem in Visual Basic version 
 1.0. We are researching this problem and will post new information 
 here as it becomes available. 
 More Information: 
 Steps to Reproduce Problem 
 -------------------------- 
 Assume the following directory structure: 
    c:\Dir1\SubDir1 
    c:\Dir1\SubDir2 
 1. Run Visual Basic, or from the File menu, choose New Project (ALT, 
    F, N) if Visual Basic is already running. Form1 will be created by 
    default. 
 2. From the Code menu, choose Save Text (ALT, C, S). 
 3. Enter c:\Dir1\SubDir1\FORM1.TXT as the full path and filename. 
 4. From the Code menu, choose Save Text (ALT, C, S) again. 
 5. Change directories in the Directories list box so that the path 
    (appearing above the Directories heading) is \Dir1\SubDir2. 
 6. Enter the following as the filename: 
       ..\SubDir1\Form1.txt 
    The two periods (..) is an MS-DOS representation for the parent 
    directory of SubDir1. 
 You will be prompted with the expected "Overwrite File" message, but 
 the path displayed in the MsgBox looks like the following: 
    c:\Dir1\SubDir2\..\SubDir1\Form1.txt 
 This path is logically correct but looks rather confusing. In this 
 situation, other Windows applications would simply display the 
 following: 
    ..\SubDir1\Form1.txt 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: Corrections for Errors in Visual Basic Version 1.0 Manuals 
Document Number: Q73655           Publ Date: 31-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 Below are corrections for documentation errors in the manuals shipped 
 with Microsoft Visual Basic version 1.0 for Windows. 
 This master list of corrections includes and adds to the correction 
 list found in sections 2 and 3 of the README.TXT file shipped with 
 Visual Basic 1.0. Please use the article below as your master list for 
 making corrections to the Visual Basic manuals. 
 More Information: 
 Microsoft Visual Basic includes the following two manuals: 
  - "Microsoft Visual Basic: Programmer's Guide" 
  - "Microsoft Visual Basic: Language Reference" 
 In both manuals, all references to OS/2 and Presentation Manager (PM) 
 are misprints, and should be ignored. 
 Corrections to the "Microsoft Visual Basic: Programmer's Guide" 
 --------------------------------------------------------------- 
 (page xv) Middle of the page: 
    "OpenError" should be 
    "OpenError:" 
 (page 15) "Running Setup", delete the following (incorrect) sentence: 
    "You can start Setup from Windows or Presentation Manager, or from 
     DOS." 
 (page 50) Fourth line: 
    "... - he names assigned by Visual Basic." should be 
    "... - the names assigned by Visual Basic." 
 (page 61) "To set the Caption property:" #2, last line: 
    "...you can skip Step 4 and proceed to Step 5." should be 
    "...you can skip Step 3 and proceed to Step 4." 
 (page 76) Add the following at the end of the first paragraph: 
    "...to distribute copies of the run-time file; however, you can 
    only distribute this run-time DLL with the .EXE file you have 
    created in Visual Basic. You cannot distribute VBRUN100.DLL by 
    itself." 
 (page 76) Bottom of the page under "Search Help for:" 
    "executable" should be 
    "executable file" 
 (page 83) Table 9.1 Standard Variable Types 
    The Type-Declaration Character for Single should be "! (or none)" 
    and 
    the Type-Declaration Character for Double should be "#". 
 (page 88) Second line: 
    "...so that Ardvark < Zypher evaluates..." should be 
    "...so that "Ardvark" < "Zypher" evaluates..." 
 (page 89) Last sentence: 
    "... the calculation of Year.sR is local and a ..." should be 
    "... the calculation of Years.  R is a local and a ..." 
 (page 97) First line: 
    "...calls to the LogB procedure..." should be 
    "...calls to the LogF procedure..." 
 (page 106) Code at bottom of page should be: 
    x = Shell("\winword\winword.exe c:\winword\plan.doc", 1) 
     and 
    y = Shell("\winproj\winproj.exe c:\winproj\schedule.wpr", 1) 
 (page 118) In the event procedure AddApp_Click, after the line of code 
            "Load AppName(LMenu)", insert the following: 
    AppName(LMenu).Separator = 0 
    Note that "Separator" is a property of a menu item that is not 
    documented in the manuals or in the on-line help. The Separator 
    property denotes whether or not a particular menu item is or is not 
    a Separator item. The caption of a Separator item in a menu cannot 
    be changed. 
 (page 129) Last paragraph, first line: 
    "...tabbing to the button and..." should be 
    "...tabbing to the option button group, using the arrow keys, and..." 
 (page 131) Middle of the page: 
    "Oct$, Str$, or Hex$ function..." should be 
    "Oct$, Format$, or Hex$ function..." 
 (page 146) Top: 
    "MsgBox msg$[,type%[,type%[,title$||" should be 
    "MsgBox msg$[,type%[,title$||" 
 (page 153) Lines 8 through 14: 
    All references to CurrentX should be CurrentY and vice versa. 
 (page 170) Code, middle of the page: 
    "TextBoxes(I).Visible = -1" should be 
    "TextBoxes(I).Visible = 0" 
    Code at bottom of the page, add the following as the first line in 
    the Form_Load procedure: 
       "Form1.Show" 
    and change the following: 
       Text1(I).Text = "Text1(" + Format(I) + ")"  should be 
       Text1(I).Text = "Text1(" + Format$(I) + ")" 
 (page 182) Code at top of page: 
    [object.|Line[(x1, y1)| - [x2, y2) [, color| should be 
    [object.|Line[(x1, y1)| - (x2, y2) [, color| 
 (page 194) Middle of the page: 
     "...given in the reverse order (Pi/3, Pi/2)..." should be 
     "...given in the reverse order (-Pi/3, -Pi/2)..." 
 (page 204) Last paragraph, second line: 
    "...continuous line when mouse button..." should be 
    "...continuous line when the left mouse button..." 
 (page 217) First sentence: 
    "... to add forms to your application You can create ..." should 
 be 
    "... to add forms to your application.  You can create ..." 
 (page 223) Last paragraph, second line: 
    "...(named GroupChoice)..." should be 
    "...(named GroupList)..." 
 (page 248) All references to the property DrawColor should be 
            omitted. There is no DrawColor property. 
 (page 261) First paragraph, second line: 
    "...variable-length strings." should be 
    "...fixed-length strings." 
 (page 267) Code at bottom of page: 
    All references to "Picture1.Picture" should be 
    "Form1.Picture1.Picture" 
 (page 270) Code at bottom of page third line from bottom: 
    "...Mid$(MyTime, 1, 2)..." should be 
    "...Mid$(MyTime, ((Hours-12)<10)+2, 2)..." 
 (page 276) Third paragraph, second line: 
    "KeyPress event ....The same thing happens when..." should be 
    "KeyDown event ...The KeyDown event gets the same code when..." 
 (page 288) Last line: 
    "MB_EXCLAIM" should be 
    "MB_ICONEXCLAMATION" 
 (page 289) Code: 
    All references to MB_EXCLAIM should be changed to MB_ICONEXCLAMATION 
 (page 308) Third paragraph of code, second nested IF THEN statement: 
    "If FileListBox.List(ind) = ..." should be 
    "If FileListBox.List(Ind%) = ..." 
 (page 311) The code under "FileListBox_DblClick" 
    "FileListBox.Pattern = *.*" should be 
    "FileListBox.Pattern = "*.*" " 
 (page 313) Do Loop should be: 
    Do Until Instr(LastOne% + 1, Test$, "\") = 0 
       LastOne% = Instr(LastOne% + 1, Test$, "\") 
    Loop 
 (page 320) Last paragraph, last sentence should be: 
    "The maximum length of a file that can be edited with Text Editor 
    is a little less than 32,000 bytes, because that is the default 
    maximum number of characters you can assign to a Visual Basic 
    multiline text box control." 
 (page 323) Code, middle of the page: 
     "Global Const ErrBadFileNameOrNumber = 52..."  should be 
     "Global Const Err_BadFileNameOrNumber = 52..." 
     "Global Const MB_EXCLAIM = 48..." should be 
     "Global Const MB_ICONEXCLAMATION = 48..." 
 (page 330) Code sample seventh to last line and (page 331) second line: 
    "EndLine$ = Input$(1, 1)" should be 
    "EndLine$ = Input$(1, FileNum)" 
 (page 339) Code under "Form_Load": 
    Add the following as the first line after "Sub Form_Load": 
       Form1.Show 
    [Without this change, running the code will result in an error: 
    "Illegal Function call" on the statement "FieldBoxes(0).SetFocus" 
    on the second-to-last line. This is because the Form is not yet 
    visible.| 
 (page 339) Code at bottom of page: 
    "WorkingFileNum = FileOpener..." should be 
    "WorkingFileNum% = FileOpener..." 
 (page 341) All reference to FieldBoxes in the code example on Page 
            341 should specify the form. For example: 
               Form1.FieldBoxes 
 (page 346) First paragraph after code, second sentence: 
   "...the statement RecordVar RecordNum = Ind% because ..." should be 
   "...the statement TempVar.RecordNum = Ind% because ..." 
 (page 357) The last two sentences of the Note should be deleted and 
            should be replaced with the following: 
    "If no application responds, Visual Basic generates a run-time 
    error." 
 (page 359) The first paragraph, last sentence should be: 
    "If the server application specified in the LinkTopic property is 
     not running, Visual Basic will generate a run-time error." 
 (page 360) Note at bottom of page: 
    References to the ALT key should be ESC key. 
 (page 364) The Link Execute Event, second argument, last line of 
            description: 
    "...the client receives a negative argument." should be 
    "...the client receives a negative acknowledgment." 
 (page 369) Under the "Starting Other Applications" section: 
    "If you attempt to establish a DDE conversation with an application 
    that is not currently running, Visual Basic displays a message 
    asking if the user wants to start the application." 
    This should be changed to be as follows: 
    "If you attempt to establish a DDE conversation with an application 
    that is not currently running, Visual Basic displays the message 
    'No foreign application responded to DDE request'." 
    In the program example, add the following as the first line after the 
    Sub statement: 
       Const DDE_NO_APP = 282 
    Also, in the program example: 
       "If Err = DDE_NO_APP"  should be changed to be as follows: 
       "If Err = DDE_NO_APP Then" 
 (page 370) "Requesting Data from Other Applications" 
    All references to "warm link" should be references to "cold 
    link". 
 (page 371) "Notifying Other Applications..." first paragraph: 
    "(in the case of a warm link)" should be 
    "(in the case of a cold link)". 
 (page 378) "To load a custom control file:" 
    Delete step 2 (the second line). 
    "Type or select the name..." should be step 2. 
 (page 380) Under "Special Considerations When Declaring DLL Routines": 
    The statement "The Visual Basic package contains a file that 
    includes the declarations for all useful routines in the operation 
    ..." is incorrect. This file is not included with Visual Basic, but 
    is part of the add-on kit, "Microsoft Windows Programmer's 
    Reference" Book and Online Resource, available from Microsoft at a 
    charge. 
 (page 385) Function declaration at the very bottom of the page: 
      Declare Function FindWindow% Lib "User" (Class as Any, 
                                               Caption as Any) 
    should be changed to be as follows: 
      Declare Function FindWindow% Lib "User" (ByVal Class as Any, 
                                               ByVal Caption as Any) 
    ByVal is needed because the function expects null-terminated strings. 
 (page 386) Code at top of page: 
    The first set of quotation marks around "Microsoft Excel" 
    should be straight quotation marks. 
    Add the following paragraph after first code fragment: 
    "The use of ByVal when passing a string is necessary because the 
    data type of that argument was declared As Any. Including ByVal 
    when passing a string declaring AsAny causes Visual Basic to 
    convert the string to the null-terminated form expected by most DLL 
    routines." 
    The following code at the bottom of the page: 
    "...Lib "User"..." should be 
    "...Lib "GDI"..." 
 (Index) A, "ALT key": 
    Delete "interrupting DDE 360" 
    A, "As Any": 
    Add to page list: "386" 
    C, after "CurrentY", add the following two entries: 
       "Cursor   Search Help files for Mouse Pointer" 
       "Cursor position   see Insertion point" 
    E, after "Errors": 
    Add new topic: "ESC Key, interrupting DDE 360" 
    I, "Index property": 
    Add to page list on "creating control arrays": "117" 
    I, "Insertion point", after "defined", add the following: 
    "locating 264" 
    L, "Line Method": 
    "boxes 188-188" should be 
    "boxes 188-189" 
    M, "Microsoft Visual Basic": 
    Change page list on "starting programs" from "17-18" to "16-17" 
    S, "Strings": 
    "variable-length 251, 385" should be 
    "use of ByVal with variable-length 251, 385, 386" 
 Corrections to "Microsoft Visual Basic: Language Reference" 
 ----------------------------------------------------------- 
 (page 6) Action: 
    "Define a Sub procedure" should be 
    "Define a procedure" 
    "Call a procedure" should be 
    "Call a Sub prodedure" 
 (page 7) in the list of objects, 
    "List" should be 
    "List Box" 
 (page 9) Windows category: 
    "hWin" should be 
    "hWnd" 
 (page 11) The Height property for the Screen object is Read-only at 
           run time for all objects (and should be marked in this chart 
           with half-dots instead of whole dots). 
 (page 27) Add to the Note the following paragraph: 
    "When you minimize a form whose AutoRedraw Property is set to False 
    (0), ScaleHeight and ScaleWidth are set to icon size. When 
    AutoRedraw is set to True (-1), ScaleHeight and ScaleWidth remain 
    the size of the restored window." 
 (page 31) Description: 
    "...for an object; for forms and picture boxes..." should be 
    "...for an object, for forms and text boxes..." 
 For the Note: 
    "...use the Show method with the form at run time. To make a 
    form modeless, set its Visible property to True(-1)."  should be 
    "...use the Show method with Style% = 1. To make a form modeless, 
    use Show with Style% = 0." 
 Add the following paragraph at the end of the Remarks section: 
    "Because of appearance, the BorderStyle for forms with a menu can 
    only be set to Sizeable (2) or Fixed Single (1). Setting the 
    BorderStyle property to None (0) or Fixed Double (3) forces the 
    BorderStyle property to Fixed Single (1)." 
 (page 52) Graphic image: 
    The image shown is an example of a check box; it should show a 
    combo box example. 
 (page 147) Description: 
    "read-only" should be 
    "read-write" 
 Change the Note to be as follows: 
    "For a form icon to be functional, the BorderStyle property must be 
    set to either 1 (Fixed Single) or 2 (Sizeable). The MinButton 
    property must be set to True (-1)." 
    "At runtime, you can assign an object's Icon property to another 
    object's DragIcon or Icon property. You can also assign an icon 
    returned by the LoadPicture function. Doing this assigns an empty 
    (null) icon, which enables you to draw on the icon at run time." 
 (page 154) Despite references on page 154 and in the VB.EXE 
            online Help, the INPUT$ function is not supported 
            for files opened with random access. Attempting to 
            use INPUT$ on a file opened for random access results 
            in a "Bad file mode" error message. (Use of INPUT$ on 
            random files was eliminated in Visual Basic, as was 
            the older Basic statement FIELD.) 
 (page 156) Condition: 
    "strexpr1$ found in strexpr2$"  should be 
    "strexpr2$ found in strexpr1$" 
 (page 158) Remarks, bottom: 
    "...property determines if timer responds..." should be 
    "...property determines if the timer control responds..." 
 (page 175) Remarks, add the following at the end of the "Cancel" 
            description: 
    "(The default is set to -1, meaning cancel)" 
 (page 184) In the second line of the Note: 
    "...by pressing the ALT key." should be 
    "...by pressing the ESC key." 
 (page 188) Last line of description should be: 
    "The List property is not available at design time; it is read-only 
    for drive, file, and directory list boxes and read-write for combo 
    and list boxes." 
 (page 191) Under Remarks, the event ordering when a form is loaded 
            should be changed to be as follows: 
       ReSize, Load, GotFocus, Paint 
 (page 204) Syntax: 
    "Mid$ (stringexpression$, start&, [length&|)" should be 
    "Mid$ (stringexpression$, start& [,length&|)" 
 (page 209) Month Function: 
    In the Case statements, delete all numbers greater than 12. 
 (page 244) Pointer Property: 
    This property does not exist. The name was changed to MousePointer 
    Property (page 214). 
 (page 254) In the code example at the bottom: 
    "Dim Deck()" should be 
    "Global Deck()" 
 (page 283) For SendKeys statement, {PG DN} should be {PGDN}, 
            otherwise you get an "illegal function call" at run time. 
 (page 284) SendKeys Statement: 
    "{SCROLLOCK}" should be 
    "{SCROLLLOCK}" 
    If a program contains this misspelling, Visual Basic will display 
    the following error message: 
    "illegal function call" 
 (page 285) Syntax: 
    The syntax fo ClipBoard.SetData should be changed from 
    "ClipBoard.SetData (data%, [format%|) to 
    "Clipboard.SetData data%, [format%|" 
 (page 290) Middle of the page: 
    "...further user input can occur." should be 
    "...other forms can respond to events or accept user input." 
 (Appendix A) ANSI Table at bottom of page: 
    "Values 8, 9, 10, and 13 convert to tab, backspace, linefeed..." 
    should be: 
    "Values 8, 9, 10, and 13 convert to backspace, tab, linefeed..." 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: Correction to WINAPI.TXT for Visual Basic Add-on Kit 
Document Number: Q74526           Publ Date: 31-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 The following corrections apply to the WINAPI.TXT file provided on 
 disk with the "Microsoft Windows Programmer's Reference" book and 
 Online Resource, add-on kit number 1-55615-413-5, for Microsoft Visual 
 Basic. 
 This information applies to Microsoft Visual Basic programming system 
 version 1.0 for Windows. 
 More Information: 
 The following corrections apply to the WINAPI.TXT file dated 5/14/91. 
 1. The following statement is incorrect 
       Declare Function SetCommState Lib "User" () 
    and should be changed to read as follows: 
       Declare Function SetCommState Lib "User" (lpDCB as DCB) As Integer 
 2. The Declare statement for WinExec is missing the ByVal attribute in 
    the second parameter. Without this ByVal, invoking WinExec can cause 
    a Windows "Unrecoverable Application Error" ("UAE"). The WinExec 
    Declare statement should be changed to read as follows (on one line): 
       Declare Function WinExec Lib "Kernel" (ByVal lpCmdLine As String, 
                                ByVal nCmdShow As Integer) As Integer 
 3. The following statement is incorrect 
       GetDC Lib "GDI" (ByVal hWnd As Integer) As Integer 
    and should be changed to read as follows: 
       GetDC Lib "USER" (ByVal hWnd As Integer) As Integer 
    In other words, the function GetDC is in the Windows "USER" 
    library (DLL), not in the "GDI" library (DLL). 
 4. The following statement is incorrect 
       Declare Function WinExec Lib "Kernel" (ByVal lpCmdLine As String, 
                                nCmdShow As Integer) As Integer 
    and should be changed to read as follows: 
       Declare Function WinExec Lib "Kernel" (ByVal lpCmdLine As String, 
                                ByVal nCmdShow As Integer) As Integer 
 5. The following two Declare statements in WINAPI.TXT 
       Declare Function SelectPalette Lib "GDI" ... 
       Declare Function RealizePalette Lib "GDI" ... 
    should be changed to "USER" instead of "GDI", as shown: 
       Declare Function SelectPalette Lib "USER" ... 
       Declare Function RealizePalette Lib "USER" ... 
    (These functions are correctly declared in the APIXREF.HLP file.) 
 For more information on WINAPI.TXT, query on the following words: 
    WINAPI.TXT and Visual and Basic 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: Creating Nested Control Arrays in Visual Basic 
Document Number: Q79029           Publ Date: 31-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 To create an array of picture controls or frames with an array of 
 child controls (such as command buttons) within each element of the 
 parent array is not possible in Visual Basic without making use of the 
 Windows API functions SetParent and GetFocus. 
 Because Visual Basic does not support overlapping controls, creating 
 controls and then simply moving them into position within previously 
 created controls will not function correctly. Using the Windows API 
 functions in conjunction with the Load and Unload methods can 
 circumvent this problem and allow dynamic, flexible structures to be 
 created during execution. 
 This information applies to Microsoft Visual Basic programming system 
 version 1.0 for Windows. 
 More Information: 
 This article explains how to get the following control structure 
 Parent Control  Child Controls on Parent 
 --------------  ------------------------ 
 Picture1(1)     Command1(1), Command1(2), Command1(3), Command1(4) 
 Picture1(2)     Command1(5), Command1(6), Command1(7), Command1(8) 
 Picture1(3)     Command1(9), Command1(10), Command1(11), Command1(12) 
 Picture1(4)     Command1(13), Command1(14), Command1(15), Command1(16) 
 (where Picture1 and Command1 are control arrays). 
 The following example uses the two API functions GetFocus and 
 SetParent to establish the proper parent/child relationships between 
 an array of picture control as parent and command buttons as an array 
 of children within the picture control. 
 The function GetFocus requires no parameters. The function SetParent 
 requires two as follows: 
 Parameter             Type and Description 
 ---------             -------------------- 
 hWndChild             HWND  Identifies the child window 
 hWndNewParent         HWND  Identifies the new parent window 
 The return value identifies the previous parent window. 
 This example also demonstrates how Windows handles a drag and drop if 
 parentage was set at run time. If the control is dragged to another 
 control of the same type as the previous parent, when released the 
 control assumes the same relative position it had in the previous 
 parent. The program demonstrates that before unloading controls nested 
 using SetParent and moved during the run, parentage should be returned 
 to the original hierarchy. This is to avoid the possibility of 
 "Unrecoverable Application Error" (UAE) messages that could occur due 
 to conflicting messages to Windows. 
 Create the following controls: 
 Control           Ctlname       Property Setting 
 -------           -------       ---------------- 
 Form              Form1 
 Picture           Picture1()    Index=1 
 Command button    Command1()    Index=1 
 Command button    Loadall       Taborder=0, Caption="Load All" 
 Command button    Loadsome      Taborder=1, Caption="Load Four" 
 Command button    Changemode    Taborder=2, Caption="DragMode=0" 
 Command button    Unloadall     Taborder=3, Caption="Unload All" 
 Note: The placement of the original picture box and command button is 
 important. The picture should be created first and the command button 
 drawn WITHIN the picture box. The placement of the other controls at 
 design time is not critical. They are resized and moved at run time. 
 Code               Purpose 
 ----               ------- 
 Loadall_Click      Loads all parent controls and all child controls 
 Loadsome_Click     Loads all parent controls and four child controls 
 Unloadall _Click   Unloads all controls. Must reset parentage to the 
                    original first! 
 Changemode_Click   Changes DragMode between auto and manual modes 
 Resetparent        General procedure to reset parentage for Unload and 
                    Close 
 Cplace             General procedure to place the four command buttons 
 Form_Resize        Code to maintain original size 
 Form_Load          Sets initial size and properties of controls 
 Form_Unload        Calls Unloadall_Click to avoid conflicting Windows 
                    messages 
 Picture1_DragDrop  Handles setting of parentage to user actions 
 Command1_Click     Sets captions to reflect change in position and 
                    state 
 Run the example and try all the buttons. Toggle the DragMode on and 
 off and drag the command buttons from one picture to another. Add the 
 following code to your program: 
 Global Module 
 ------------- 
 Declare Function setparent% Lib "user" (ByVal h%, ByVal h%) 
 Declare Function getfocus% Lib "user" () 
 Global Handle2Child As Integer 
 Global Handle2Parent As Integer 
 Global dragstate, loadstate, toggle, innernum As Integer 
 Global I, N, K As Integer 
 Global xoffset, yoffset, cmdnum, childsize, parentsize As Integer 
 Global Const maxouter = 4 
 Global Const maxinner = 4 
 Option Base 1 
 Global storecaption(16) As String     'array=maxinner*maxouter 
 Form1 
 ----- 
 Sub Picture1_DragDrop (index As Integer, source As Control, X As 
 Single, Y As Single) 
  picture1(index).SetFocus 'Procedure for control array of parent Picture Bo xes
  Handle2Parent = getfocus() 
  source.SetFocus 
  Handle2Child = getfocus() 
  ret% = setparent(Handle2Child, Handle2Parent) 
 source.caption = Mid$(source.caption, 1, 1) + "/" + 
  LTrim$(RTrim$(Str$(index))) 
 End Sub 
 Sub Form_Load () 
 form1.width = screen.width - screen.width \ 8 
 form1.height = screen.height \ 2 
 form1.backcolor = &HFFFF00 
 form1.caption = "Nested Control Arrays" 
 picture1(1).visible = 0 
 command1(1).visible = 0 
 parentsize = CInt((form1.width \ maxouter) * .8) 
 childsize = CInt((2 * parentsize \ maxinner) * .6) 
 picture1(1).height = parentsize 
 picture1(1).width = parentsize 
 command1(1).height = childsize 
 command1(1).width = childsize 
 cplace loadall, 1 
 cplace loadsome, 2 
 cplace changemode, 3 
 cplace unloadall, 4 
 End Sub 
 Sub resetparent ()      'Function to clean up parentage before unload 
 picture1(1).SetFocus 
 Handle2Parent = getfocus() 
 For I = innernum To 1 Step -1 
     command1(I).SetFocus 
     Handle2Child = getfocus() 
     ret% = setparent(Handle2Child, Handle2Parent) 
 Next I 
 End Sub 
 Sub Command1_Click (index As Integer)   'Procedure for control array 
                                         'of Buttons 
 If toggle Then 
 command1(index).caption = storecaption(index) 
 toggle = 0 
 Else 
 storecaption(index) = command1(index).caption   ' change caption to 
                                                 ' reflect state 
 command1(index).caption = "ON" 
 toggle = -1 
 End If 
 End Sub 
 Sub Form_Unload (Cancel As Integer)     'Cleans up before program exit 
 unloadall_click 
 End Sub 
 Sub changemode_Click () 'Toggles between automatic & manual dragmodes 
 If loadstate Then 
     If Not dragstate Then 
     For I = 1 To innernum 
     command1(I).dragmode = 1  'automatic 
     dragstate = -1            'reset flag 
     Next I 
     changemode.caption = "DragMode=1" 
     Else 
     For I = 1 To innernum 
     command1(I).dragmode = 0  'manual 
     dragstate = 0             'reset flag 
     Next I 
     changemode.caption = "DragMode=0" 
     End If 
 End If 
 End Sub 
 Sub unloadall_click () 'Unloads all dynamically created controls ONLY 
 Select Case loadstate 
 Case 1 
 resetparent                  'Must call prior to unload to avoid UAEs 
 For I = maxouter To 1 Step -1 
         For N = maxinner To 1 Step -1 
         cmdnum = ((I - 1) * 4) + N 
         If cmdnum <> 1 Then Unload command1(cmdnum) 
         Next N 
         If I <> 1 Then Unload picture1(I) 
 Next I 
 command1(1).visible = 0           'Can't unload controls 
 picture1(1).visible = 0           'created at design time so hide! 
 loadstate = 0                 'reset flag for load routines 
 changemode.enabled = 0 
 Case 2 
 resetparent               'Must call prior to unload to avoid UAEs 
 For I = maxouter To 1 Step -1 
        If I = 1 Then 
             For N = maxinner To 2 Step -1 
             Unload command1(N) 
             Next N 
        End If 
 If I <> 1 Then Unload picture1(I) 
 Next I 
 command1(1).visible = 0          'Can't unload controls 
 picture1(1).visible = 0        'created at design time so hide! 
 loadstate = 0               'reset flag for load routines 
 changemode.enabled = 0 
 End Select 
 End Sub 
 Sub loadsome_click ()  'Loads all parents and one set of children 
 If loadstate = 0 Then  ' to demonstrate drag and drop 
 changemode.enabled = -1 
 command1(1).Move 0, 0 
 For I = 1 To maxouter 
     If I <> 1 Then 
         Load picture1(I)  ' can't load control created at design time 
     End If 
     picture1(I).Move -picture1(1).width, -picture1(1).height, 
                                parentsize, parentsize  ' ** 
     picture1(I).visible = -1     'load off-screen /\ 
     picture1(I).SetFocus 
     Handle2Parent = getfocus()    'get handle by API call 
     If I = 1 Then 
         For N = 1 To 4 
             If N <> 1 Then 
              Load command1(N) 'can't load control created at design time 
             End If 
             xoffset = picture1(I).scalewidth \ 4 - 
                       command1(N).width \ 2 + 
                       ((N - 1) Mod 2) * (picture1(I).scalewidth \ 2) ' ** 
             If N > 2 Then 
                yoffset = picture1(I).scaleheight \ 2 + 
                          (picture1(I).scaleheight \ 4 - 
                          command1(N).height \ 2)   ' ** 
 'Note: All code statements (in all procedures) MUST be on one line! 
             Else yoffset=(picture1(I).scaleheight\4-command1(N).height\2) 
             End If 
             command1(N).Move xoffset, yoffset 
             command1(N).visible = -1 
             command1(N).SetFocus 
             Handle2Child = getfocus()        'get handle by API call 
             ret% = setparent(Handle2Child, Handle2Parent) 'Call API functio n 
             command1(N).caption = LTrim$(RTrim$(Str$(N))) + "/" + 
                                   LTrim$(RTrim$(Str$(I)))  ' ** 
         Next N 
     End If 
 Next I 
 xoffset = ((form1.scalewidth \ maxouter) - picture1(1).width) \ 2 
 picture1(1).Move xoffset, 0 
 For I = 2 To maxouter 
   picture1(I).Move (I - 1) * (form1.scalewidth \ maxouter) + 
                    xoffset, picture1(I - 1).top ' ** 
 Next I 
 innernum = 4  'set global loop maximum 
 loadstate = 2 
 End If 
 End Sub 
 Sub loadall_click () 'Loads all parents and children in nested structure 
 If loadstate = 0 Then 
 changemode.enabled = -1 
 command1(1).Move 0, 0 
 For I = 1 To maxouter               '/\ size command button proportionally 
     If I <> 1 Then Load picture1(I) 'can't load control created at 
                                     'design time 
     'load off-screen: 
     picture1(I).Move -picture1(1).width, -picture1(1).height 
     picture1(I).visible = -1 
     picture1(I).SetFocus 
     Handle2Parent = getfocus()      'get handle by API call 
         For N = 1 To maxinner 
             cmdnum = ((I - 1) * 4) + N 
             If cmdnum <> 1 Then 
             Load command1(cmdnum) 'can't load control created at 
                                   'design time 
             End If 
             xoffset=((N-1) Mod 2)*(picture1(I).scalewidth\(maxinner\2)) 
             If N > 2 Then 
                 yoffset = picture1(I).scaleheight \ 2 
             Else yoffset = picture1(I).scaletop 
             End If 
             command1(cmdnum).Move picture1(I).scalewidth \ 8 + 
                    xoffset, picture1(I).scaleheight \ 8 + yoffset ' ** 
             command1(cmdnum).visible = -1 
             command1(cmdnum).SetFocus 
             Handle2Child = getfocus()       'get handle by API call 
             ret% = setparent(Handle2Child, Handle2Parent) 'Call API functio n 
         Next N 
 Next I                          'Caption the control array buttons 
     For K = 1 To (maxinner * maxouter) 
     command1(K).caption = LTrim$(RTrim$(Str$(K))) 
     Next K 
 xoffset = ((form1.scalewidth \ maxouter) - picture1(1).width) \ 2 
 picture1(1).Move xoffset, 0 
 For I = 2 To maxouter 
         picture1(I).Move (I - 1) * (form1.scalewidth \ maxouter) + 
                                xoffset, picture1(I - 1).top ' ** 
 Next I 
 innernum = 16  'set global loop maximum 
 loadstate = 1 
 End If 
 End Sub 
 Sub Form_Resize () 
 form1.width = screen.width - screen.width \ 8 
 form1.height = screen.height \ 2 
 End Sub 
 Sub cplace (dummy As Control, num As Integer)   'size static controls 
 theheight% = parentsize + childsize * 2 
 dummy.Move (form1.width \ 4) * (num - 1) + parentsize \ 10, 
                           theheight%, parentsize, childsize ' ** 
 End Sub 
 ** Note: These statements are shown on multiple lines, but must be on 
 a single line in Visual Basic's Code window. 
 Reference(s): 
 "Microsoft Windows Programmer's Reference Book and Online Resource," 
 version 3.0, Visual Basic add-on #1-55615-413-5 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: Incorrect Error 71 Opening File on Write Protected Disk 
Document Number: Q79373           Publ Date: 31-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 When trying to open a file for output on a write protected disk, a 
 Visual Basic program incorrectly returns error message 71, "Disk 
 Not Ready" (rather than error 70, "Permission Denied"). 
 Microsoft has confirmed this to be a 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. 
 This problem occurs when you run the program both in the VB.EXE 
 environment and as an .EXE file. 
 More Information: 
 You will find the following correct definitions for errors 70 and 71 
 by searching under trappable errors in Visual Basic online Help 
 (press F1 for Help in VB.EXE): 
    Error 70 "Permission Denied" 
    An attempt was made to write to a write-protected disk or to access 
    a locked file. For example this error will occur if an Open For 
    Output statement is performed on a write-protected file. 
    Error 71 "Disk Not Ready" 
    There is no disk in the drive specified or the drive door is open. 
    Insert a disk in the drive, close the door and retry the operation. 
 When a program tries to create a file on the protected disk, error 71 
 incorrectly occurs, as shown in the program below. The correct error 
 message should be 70. 
 Example 
 ------- 
 Start Visual Basic and add the following code to the Form1 Click event 
 procedure: 
    Sub Form1_Click() 
      Open "a:bigone" For Output as #1 
    End Sub 
 Put a write-protected disk in your disk drive, then run the program 
 and click on the form. Your drive light will come on and Visual Basic 
 will report a "Disk Not Ready" error. If you set up an On Error 
 routine to trap the error, the Err function incorrectly returns error 
 number 71, meaning "Disk Not Ready." (The same results occur in an 
 .EXE file.) 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: High Granularity Setting Affects Windows/VB Form Resizing 
Document Number: Q79386           Publ Date: 31-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 If you set the granularity of Windows' invisible sizing grid to a 
 value greater than zero, you may notice that form resizing is no 
 longer smooth. This behavior is correct and can be changed by setting 
 the granularity back to zero. 
 This information applies to all Microsoft Windows 3.0 and 3.0a 
 programs, including programs written with Microsoft Visual Basic 
 programming system version 1.0 for Windows. 
 More Information: 
 The Windows Control Panel program group contains several icons that 
 allow you to customize the Windows environment. The Desktop program 
 allows you to specify the Windows granularity setting. If you notice 
 that Visual Basic forms do not smoothly resize, but instead resize in 
 "chunks," the problem may be caused by a granularity setting that is 
 too high. 
 To change the Windows granularity setting, do the following: 
 1. Open the Windows Main program group. 
 2. Double-click on the Control Panel icon. 
 3. Double-click on the Desktop icon. 
 4. Move to the granularity text box in the lower right portion of the 
    dialog box. 
 5. Click the up or down scroll arrow to the right of the text box to 
    increase or decrease the size of the grid. Or, type the number you 
    want in the text box. 
    Note: The allowable range of values is 0-49 inclusive. Setting the 
    granularity to zero will produce the smoothest form resizing. 
 6. Choose OK. 
 Reference(s): 
 "Microsoft Windows 3.0 Graphical Environment: Users Guide," version 
 3.0, page 157 
 Additional reference words: 1.00 3.00 3.00a 

COPYRIGHT Microsoft Corporation, 1991.


Knowledge Base

Title: In VB DDE, LinkRequest "Unexpected Error: Quitting" 
Document Number: Q79387           Publ Date: 31-DEC-1991 
Product Name: Microsoft Visual Basic 
Product Version:  1.00 
Operating System: WINDOWS 

 Summary: 
 While performing a DDE LinkRequest between two Visual Basic 
 applications, an "Unexpected Error: quitting" message will be 
 displayed under the following conditions: 
  - The DDE conversation is established from a label control or text 
    box in the client application. 
  - The DDE conversation is established to a text control in the server 
    application. 
  - The server application text box is assigned the result of a string 
    operation where the string operation involves the text property of 
    the text box (such as: Text1.Text = Text1.Text + "Hello world"). 
  - The amount of text in the server application text box exceeds 32K. 
  - A LinkRequest is performed from the client application to obtain 
    information in the text box of the server application. 
 Microsoft has confirmed this to be a problem in the 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: 
 Steps to Reproduce Problem 
 -------------------------- 
 Part 1: Creating the Client Application 
 --------------------------------------- 
 1. Run Visual Basic or choose New Project from the File menu if 
    Visual Basic is already running. Form1 will be created by 
    default. 
 2. Change the LinkTopic property of Form1 to Null. 
 3. Change the LinkMode property of Form1 to None (0). 
 4. Place a label control (Label1) on Form1. 
 5. Place the following code in Form1's Click event procedure: 
      Sub Form1_Click () 
           Label1.LinkMode = 0 
           Label1.LinkTopic = "Project1]Form1" 
           Label1.LinkItem = "Text1" 
           Label1.LinkMode = 2         'Establish a cold link 
      End Sub 
 6. Place the following code in Label1's Click event procedure: 
      Sub Label1_Click () 
           Label1.LinkRequest 
      End Sub 
 7. From the File menu, choose Make EXE File (ALT, F, K) to create 
    PROJECT1.EXE. 
 8. Choose OK from the Make EXE File dialog box. 
 Part 2: Creating the Server Application 
 --------------------------------------- 
 1. From the File menu, choose New Project (ALT F, N). 
 2. Select No in response to the "Save changes to Form1" prompt. 
 3. Select No in response to the "Save changes to Project1" prompt. 
    Form1 will be created by default. 
 4. Place a text box (Text1) on Form1. 
 5. Change the MultiLine property of Text1 to True. 
 6. Place the following code in the Form1_Click event procedure. 
      Sub Form1_Click () 
           Text1.Text = "" 
           For i = 1 to 320 
               Text1.Text = Text1.Text + String$ (98, "a") + Chr$(13) + 
                            Chr$(10) 
           Next i 
      End Sub 
 7. From the Run menu, choose Start (ALT, R, S). 
 8. Click inside Form1 to begin filling the text box with 32,000 "a"s. 
    Note: This process may take a few minutes. 
 9. After the Form1_Click event procedure has finished executing, 
    choose Break from the Run menu. 
 Part 3: Establishing the DDE Link 
 --------------------------------- 
 1. From the Program Manager File menu, choose Run (ALT, F, R). 
 2. From the Run dialog box, type in the full path and filename to the 
    location of the file created in Part 1 (Project1.EXE) and choose OK. 
    Form1 for PROJECT1.EXE should appear on the screen. 
 3. Click Form1 of PROJECT1.EXE (this will initialize the DDE 
    conversation between PROJECT1.EXE and the project running inside of 
    the Visual Basic environment). 
 4. Click Label1 in Project1. 
 5. In the Visual Basic Immediate window, type the following code on 
    one line: 
     For i = 1 to 10 : Text1.Text = Text1.Text + String$(98, "a") 
                       + Chr$(13) + Chr$(10) : Next i 
    Note: This will add an additional 10,000 bytes to the text box, 
    bringing the total to 33,000 bytes. 
 6. In Project1.EXE, click Label1 again. 
 The "Unexpected Error : quitting" error will occur and Visual Basic 
 will shut down. 
 Additional reference words: 1.00 

COPYRIGHT Microsoft Corporation, 1991.




!off


Thank you for using CompuServe!

Off at 12:02 PST 7-Jan-92
Connect time = 0:15
