home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l391 / 1.ddi / COMPAT.TX$ / COMPAT.bin
Encoding:
Text File  |  1992-08-19  |  6.3 KB  |  149 lines

  1.                                    COMPAT.TXT
  2.  
  3.           Compatibility Notes for Visual Basic for MS-DOS and Windows
  4.  
  5.                    (C) Copyright Microsoft Corporation, 1992
  6.  
  7. This document contains miscellaneous programming differences between
  8. Visual Basic for MS-DOS (VB/MS-DOS) and Visual Basic for Windows (VB/Windows)
  9. that were too late-breaking to include in the printed documentation. See
  10. Appendix I, "Building Portable Applications," in the "Programmer's Guide"
  11. for more comprehensive information on this subject.
  12.  
  13. Differences in Scope
  14. --------------------
  15. In VB/MS-DOS, shared array declarations cannot be "eclipsed" at the procedure
  16. level. This means that the following code behaves differently in VB/MS-DOS
  17. and VB/Windows:
  18.  
  19. DIM SHARED Array%()
  20. CALL Initialize
  21.  
  22. SUB Initialize ( )
  23.   DIM Array%(100)  ' In VB/Windows, creates a new Array%() that "eclipses"
  24. END SUB            ' the shared variable. In VB/MS-DOS, dimensions Array%.
  25.  
  26. Menus and Timer Events
  27. ----------------------
  28. In VB/MS-DOS, timer events are suspended while a menu control has focus.
  29. When the menu control loses focus, timer events resume. Timer events are
  30. not suspended in this way in VB/Windows.
  31.  
  32. ERR Statement
  33. -------------
  34. In VB/MS-DOS, you cannot use the ERR statement to set error codes >255.
  35. To work around this, use ERROR to recreate the error and indirectly set
  36. the error code.
  37.  
  38. Forms
  39. -----
  40. Setting BorderStyle to None (0) in VB/MS-DOS results in MinButton,
  41. MaxButton, and ControlBox being set to FALSE (0) at run-time. 
  42. In VB/Windows, these properties are not set to FALSE but retain the
  43. same values that are set at design-time.
  44.  
  45. Clicking on disabled controls in VB/Windows results in a click event 
  46. being sent to the form. This does not occur in VB/MS-DOS. The click
  47. is ignored.
  48.  
  49. VB/MS-DOS allows a form to be unloaded from within its RESIZE event 
  50. procedure. VB/Windows does not allow this (generates an error).
  51.  
  52. File List Boxes
  53. ---------------
  54. VB/Windows will return error 380 when setting the Pattern property of
  55. File List boxes to any of the following: ";", ":", or "\". VB/MS-DOS will
  56. not return an error but will assign this value to the Pattern property 
  57. and generate a PatternChange event. Both VB/Windows and VB/MS-DOS handle 
  58. other invalid pattern assignments (i.e. "=") in a similar manner (assign 
  59. the value to Pattern property and generate PatternChange event.
  60.  
  61. VB/Windows will generate error 53 (File not found) when assigning a 
  62. non-existent file name to the FileName property of File List boxes. 
  63. VB/MS-DOS will not generate an error, but rather will parse the value 
  64. assigned to the FileName property as a value for the Pattern property, 
  65. a value for which no match will be found. To determine if a file exists, 
  66. either the DIR$ function or check that File1.FileName = "" and 
  67. File1.Pattern = <non-existent file> after the assignment.
  68.  
  69. VB/Windows returns file names (FileName property) in lower case. VB/MS-DOS 
  70. returns file names in upper case.
  71.  
  72. List Boxes
  73. ----------
  74. In VB/MS-DOS, the selected item must always be visible within the list
  75. box. In VB/Windows, the selected item can be scrolled out of sight with
  76. the mouse. Thus in VB/MS-DOS, as you scroll the listbox with the mouse,
  77. the selected item will change to remain visible. This functions
  78. exactly like scrolling the list box with the keyboard cursor keys in
  79. either VB/MS-DOS or VB/Windows. 
  80.  
  81. Text Boxes
  82. ----------
  83. In VB/Windows, text boxes with horizontal scrollbars (no word wrap) will 
  84. still wrap text longer than 1023 characters. In VB/MS-DOS, text boxes with 
  85. horizontal scrollbars will not wrap text regardless of length.
  86.  
  87. VB/MS-DOS text boxes (including text portion of combo box) do not support 
  88. word highlight with double mouse click. VB/Windows text boxes do support 
  89. this feature.
  90.  
  91. Keywords
  92. --------
  93. VB/MS-DOS and VB/Windows support some different reserved words. Conflicts 
  94. may occur if a reserved word in VB/MS-DOS or VB/Windows is used as a variable 
  95. name in the other product (where it is not a reserved word). Replace all 
  96. occurances of these type of variable names with new names. A common example 
  97. of this is LIST (reserved in VB/MS-DOS, but not in VB/Windows).
  98.  
  99. COMMAND$
  100. --------
  101. The case of the text returned by the COMMAND$ function is different in 
  102. VB/Windows and VB/MS-DOS. VB/MS-DOS returns an all upper case string while 
  103. VB/Windows returns the string in the same case the user provide it.
  104.  
  105. Form/Control Allocation
  106. -----------------------
  107. In VB/MS-DOS, window structures for forms and controls remain allocated after an
  108. unload (form or control array element) until the last procedure in the
  109. current calling sequence ends and control returns to the top-most DOEVENTS 
  110. loop (either implicit or explicit). Form and control data space is freed 
  111. immediately after an unload however. 
  112.  
  113. In VB/Windows, window structures are deallocated after the unload. This may 
  114. cause differences in the number of forms and controls that can be loaded 
  115. and unloaded within the current calling sequence depending on available 
  116. memory.
  117.  
  118. ActiveControl and Disabled Controls
  119. -----------------------------------
  120. If you disable all of the controls on a form in code, SCREEN.ActiveControl
  121. returns the last enabled control in VB/MS-DOS. The same action returns an 
  122. error in VB/Windows. For example, if a form has one control named cmdExit, 
  123. this code produces different results in VB/MS-DOS and VB/Windows:
  124.  
  125. cmdExit.Enabled = FALSE
  126. x% = SCREEN.ActiveControl.Enabled ' In VB/MS-DOS, x% = 0. In VB/Windows, 
  127.                                   ' causes error.
  128.  
  129. In VB/Windows, Screen.ActiveControl returns an error if all the controls on
  130. a form are disabled. In VB/MS-DOS, SCREEN.ActiveControl returns the most
  131. recently enabled control if all the controls on a form are disabled.
  132.  
  133. Loading Controls Passed to Procedures
  134. -------------------------------------
  135. VB/MS-DOS compiled programs, you cannot pass a control array element into a
  136. procedure, then load it from that procedure. For example, the following
  137. code generates the error "Control array element does not exist" if
  138. executed in a compiled program:
  139.  
  140. LoadIt cmdButton(1)
  141.  
  142. SUB LoadIt (X as CONTROL)
  143.   LOAD X
  144. END SUB
  145.  
  146. Note that the preceding code will run in the VB/MS-DOS programming
  147. environment without an error. This difference occurs because compiled
  148. applications are "early bound."
  149.