home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / WINDOWS / PROGRAM / VBASIC.ZIP / VB#2 < prev   
Encoding:
Text File  |  1991-05-30  |  11.2 KB  |  185 lines

  1.         
  2.         ╔══════════════════════════════════════════════════════════════╗
  3.         ║        Steve Gibson's Second InfoWorld TechTalk Column       ║
  4.         ║              about Microsoft's new Visual Basic              ║
  5.         ╚══════════════════════════════════════════════════════════════╝
  6.  
  7.         Microsoft's new Visual Basic product is destined to dramatically 
  8.         change the way the world feels about and uses the Windows 
  9.         operating environment. In the few short days I spent learning 
  10.         and understanding this new system, I stunned myself and my co-
  11.         workers by created two lovely and significant networked 
  12.         applications as well as several simpler experimental programs. 
  13.         Although deliberate programming still lies at the heart of VB, 
  14.         and complex applications can still become complicated, Visual 
  15.         Basic rewards investment so rapidly that you're literally sucked 
  16.         into the experience of finding out more about how to make it do 
  17.         the things you want. After Microsoft left a copy of VB with me, 
  18.         I began to play, skipping a night of sleep just to cram more VB-
  19.         time into my life. It really is THAT addictive. In the past few 
  20.         weeks I've written several quite-significant applications that I 
  21.         would have never attempted in any other programming environment. 
  22.         I would simply have gone without. 
  23.  
  24.         Visual Basic will succeed like few products ever have by 
  25.         offering significant value to an extremely wide audience. Casual 
  26.         computer hobbyists will enjoy crafting their own entertaining 
  27.         applications that look as good as anything available 
  28.         commercially. In-house corporate developers, who will now be 
  29.         spared the horrendous task of mastering the Windows Software 
  30.         Development Kit (SDK), can quickly assemble sophisticated and 
  31.         readily maintainable networked applications to suit their 
  32.         company's unique needs. Since VB applications have full access 
  33.         to the Dynamic Link (DLL) Libraries and Dynamic Data Exchange 
  34.         (DDE) links of other applications, VB can be used to provide 
  35.         customized extensions to existing applications, as well as to 
  36.         glue disparate applications together. 
  37.  
  38.         Consultants will be able to build custom packages to solve their 
  39.         client's needs overnight. They'll be able to charge more and 
  40.         deliver more by capitalizing upon VB's amazing programming 
  41.         leverage. Full-time Windows developers, who would probably 
  42.         choose not to develop their commercial applications in Visual 
  43.         Basic, can still use VB to quickly implement prototype user-
  44.         interface scenarios for management's approval. What's more, less 
  45.         technical front-end designers of commercial products can quickly 
  46.         prototype their ideas for final implementation by SDK power 
  47.         programmers. 
  48.  
  49.         And finally, since the entire Windows SDK function library is 
  50.         directly available through Visual Basic, would-be SDK developers 
  51.         can easily learn and experiment with the operation of the 
  52.         Windows SDK functions from within VB's comfortable and forgiving 
  53.         environment. 
  54.  
  55.         Visual Basic is a powerfully leveraging language product with 
  56.         something for every programmer. However, I don't want anyone to 
  57.         receive the mistaken impression that Visual Basic instantly 
  58.         turns everyone into a programmer. It doesn't. It's probably 
  59.         better to think of VB as an incredible power tool for existing 
  60.         programmers of any level. Unlike Borland's forms-oriented 
  61.         ObjectVision product, which uses the metaphor of fill-in forms 
  62.         driven by graphical decision trees to create living "intelligent 
  63.         forms," Visual Basic is NOT a product for non-programmers. 
  64.  
  65.         Visual Basic uses the concept of a "project" to collect and 
  66.         organize the application's component files. A VB project 
  67.         consists of one project make file, one global file, zero or more 
  68.         forms, zero or more code-modules, and zero or more controls 
  69.         extension files. Let's look at each file type in turn. 
  70.  
  71.         The project's "make file" lists the collection of files upon 
  72.         which the project depends. When a project is "Opened" the make 
  73.         file window shows the file name and its corresponding project 
  74.         name for each file component. When the "Save Project" command is 
  75.         given, VB saves any of the project's files that have been 
  76.         changed. 
  77.  
  78.         Every project also consists of exactly one global declarations 
  79.         file into which project-wide constant and variable declarations 
  80.         are placed. A provided file called CONSTANTS.TXT is usually 
  81.         loaded into the project's global file to pre-define a number of 
  82.         system-wide constants. Since the global file cannot contain 
  83.         executable code, each project also requires a minimum of at 
  84.         least one form or code-module file containing executable 
  85.         instructions. The form files are perhaps the most interesting 
  86.         since they represent and define the visible surfaces in a VB 
  87.         application. When a new project is created, one form is created 
  88.         by default, though this may be removed for applications not 
  89.         requiring significant user interaction. Code module files 
  90.         contain executable code that's not directly related to the 
  91.         controls on individual forms. For example, a general-purpose 
  92.         subroutine library might be placed into and referenced in a code 
  93.         module file. Controls extension files allow the standard Windows 
  94.         controls such as push buttons, radio buttons, check boxes, 
  95.         scroll bars, etc. to be extended beyond those supported by 
  96.         Windows. SDK power programmers can create libraries of 
  97.         additional controls such as gas gauges, slider knobs, or 
  98.         whatever, and provide them for use by Visual Basic programmers. 
  99.         I predict that we'll see an active market of these VBX (Visual 
  100.         Basic Xtension) controls before long. 
  101.  
  102.         When a new project is first started, a blank form is presented 
  103.         to the user. To the left of the form is the familiar toolbox 
  104.         menu which contains an assortment of "things." Unlike a simple 
  105.         drawing program that rubberbands rectangles, circles, and so 
  106.         forth, Visual Basic allows its user to literally "draw" command 
  107.         buttons, radio buttons, check boxes, text boxes, list boxes, 
  108.         scroll bars, and all of the other Windows objects we've become 
  109.         familiar with. If .VBX files have also been loaded into the 
  110.         project's make file, their own toolbox icons will also appear 
  111.         appended to the standard VB toolbox. The significant difference 
  112.         with Visual Basic is that rather than these being dead images of 
  113.         Windows controls, these things are actually living, functional 
  114.         control objects which are then "wired up." 
  115.  
  116.         It's convenient to think of a form as a visible surface 
  117.         containing controls with control-handling code buried 
  118.         underneath. Double-clicking upon any of a form's control objects 
  119.         takes the user beneath the form's surface to that object's 
  120.         collection of associated methods. For example, double-clicking 
  121.         upon the first command button that was created on a form would 
  122.         take you to a window containing the two lines: "Sub 
  123.         Command1_Click ()" and "End Sub". "Sub" is shorthand for 
  124.         subroutine, and the subroutine name "Command1_Click" indicates 
  125.         that it will be automatically executed by VB when the Command1 
  126.         button receives a "click" action from the user. This means that 
  127.         each control object is associated with a collection of 
  128.         subroutine methods which are invoked when the respective action 
  129.         is received by the control. 
  130.  
  131.         Designing an entire Visual basic application amounts to defining 
  132.         and drawing a collection of forms and controls, then filling-in 
  133.         the subroutines with the actions you want each control to 
  134.         respond with. 
  135.  
  136.         In addition to subroutine methods, every Visual Basic object 
  137.         also maintains a collection of internal "properties." Object 
  138.         properties are like internal variables that specify design-time 
  139.         things like the control's location and size on the form, as well 
  140.         as run-time things like whether or not the control is enabled or 
  141.         visible at this moment. Even the forms that contain control 
  142.         objects are objects with user settable properties such as the 
  143.         style of their outlines and whether or not they're resizable and 
  144.         minimizable at run-time. 
  145.  
  146.         The properties assigned to objects are referred to in program 
  147.         code with a familiar record-style "dot" syntax. For example, a 
  148.         command button's width could be accessed by the phrase 
  149.         "Command1.Width". Most properties can thus be determined and 
  150.         changed by program code. 
  151.  
  152.         Since most object properties are accessible both at design-time 
  153.         and during run-time, many unusual effects are possible. For 
  154.         example, in the first application I designed, a control button 
  155.         shot across the control panel hitting the far edge, then bounced 
  156.         along to its final position. In another of my first applications 
  157.         a list of instructions initially appeared above a three-line 
  158.         list box. When the user had read the instructions and started 
  159.         the application by clicking upon the "Start" button, the 
  160.         instructions disappeared and the list box sprang to full 
  161.         operating size. All these effects were achieved by altering the 
  162.         object's initial design-time properties at run-time. 
  163.  
  164.         Visual Basic supports such easy tinkering and fiddling with the 
  165.         user's experience of a Window's application that the resulting 
  166.         Windows EXE applications have more intrinsic friendly 
  167.         functionality than any we've seen before. What's more, such 
  168.         applications would have been impossible to create if it weren't 
  169.         for the leveraging power provided by Visual Basic. 
  170.  
  171.         The people to whom I've demonstrated VB have evidenced the 
  172.         standard turned-up nose at the notion of programming in anything 
  173.         named "Basic." I've explained that this is just a standard 
  174.         Microsoft dementia about the insistence of the use of the term 
  175.         Basic. Yes, I wish Microsoft had left this new "thing" named 
  176.         Thunder, the product's internal code name, just as Apple left 
  177.         their winning graphical machine named Macintosh. On the other 
  178.         hand, after seeing how VB has empowered me to create Windows 
  179.         applications for the first time, even my skeptical Basic-hating 
  180.         friends have wanted to get their hands on it. I predict that you 
  181.         will too. 
  182.                                                         - Steve.
  183.  
  184.         ════════════════════════════════════════════════════════════════
  185.