Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


September 1997

A Quick Tour of Visual Basic 5.0


RSS
Subscribe to Windows IT Pro | See More Visual Basic (VB) Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Microsoft's Visual Basic (VB) 5.0 development tool offers a new integrated development environment (IDE), an updated language engine that provides native code compilation, and a substantial number of features. The new IDE will make all VB developers more productive, and faster execution of native code will especially benefit algorithmic-intensive applications and components. Microsoft gives special emphasis to Internet and intranet development--particularly the ability to create ActiveX controls--to let VB developers quickly build and deploy Web-based applications. Developers who use VB for corporate data access are probably the largest and most visible segment of VB users. These developers can use the latest versions of VB's data access engines to take advantage of new features and substantially increased performance.

Native Code Compilation
The feature developers requested most in VB 5.0 is the ability to compile source code to natively execuTable code. VB 5.0 uses the same two-pass compilation process as Visual C++. The first pass parses the code and generates a preprocessed interim format; the second pass optimizes and generates native code. VB 5.0 supports several of the same compiler options as VC++. The most noTable option is the ability to optimize for fast vs. small code.

Although developers were begging for native code, what they really wanted was the execution speed that comes with natively compiled languages such as C. Native code offers substantial performance improvements in numeric-intensive operations, but it isn't a cure-all for every performance bottleneck. Native code makes sense in a VB application when developers must resort to C for writing a performance-critical part of the application. With VB 5.0, instead of learning a new language (or finding someone else to write the code), developers can now get accepTable performance from a language they already know.

An assumption many people make about native code compilation is that it eliminates the need for a corresponding runtime. On the contrary, any p-code or native code component or execuTable still requires the VB 5.0 runtime. This runtime requirement is not necessarily a bad thing. The alternative to dynamically loading a common library (which is shared across many applications) is for each application to statically link to it, thus loading the library into memory in each process. In practice, of course, the linker works with a standard library format to pull into the execuTable-only functions that the main program calls. Unfortunately, Microsoft never designed VB to be a library of discrete callable routines.

Language Features
VB 5.0 adds several important features to the underlying language engine. The most useful feature is the ability to create, or source, events. Every edition of VB has supported event-generating components (e.g., a CommandButton's Click event). VB 4.0 let developers create object servers that exposed properties and methods, but signaling between object servers was either inefficient (using timer-based code to periodically poll an object and check its status) or complicated (passing an internal object to the server, which subsequently executed an exposed method to call back into the internal object). Using VB 5.0, developers can create and handle events.

To the outside world, an object's interfaces (which include its exposed properties, methods, and events) define the object. Using the component object model (COM) architecture that underlies Object Linking and Embedding (OLE) and ActiveX, one advanced component can include the interfaces that another original component provides. An application that uses the original component could have the advanced component transparently replace the original component. A powerful feature of VB 5.0 is its ability to build ActiveX components that expose the properties and methods (but not, in this release, the events) of one or more object servers. This feature, which enables multiple implementations of a particular object specification, lets VB 5.0 developers create polymorphic objects, according to well-established OOP methodologies.

Fortunately, not all the new features in VB 5.0 relate to creating ActiveX servers. For instance, developers can use the AddressOf operator to pass the address of a VB procedure to an external DLL function. This operator lets VB developers use the Windows API functions that require a fixed callback address. AddressOf lets you trap any Windows messages sent to a form or control. Previous versions of VB required developers to use a third-party product to trap these messages. In addition, when you use AddressOf with the Win32 CreateThread API, you can create multithreaded applications in VB.

Internet
Most developers knew about VB 5.0's ability to create ActiveX controls long before Microsoft posted the Control Creation Edition beta on its Web site. You can use ActiveX controls in non-Web applications (they will be a key technology in future Microsoft operating systems), but features such as code signing and progressive downloading of data make ActiveX controls particularly well suited to Web applications. However, the VB 5.0 runtime requirement poses one problem for Web applications. To run a VB 5.0 ActiveX control, the VB 5.0 runtime must be present on the target system. This presence means that the first time you download a VB 5.0 ActiveX control, you must also undergo the 1.3MB download of the runtime before you can use the control. The control creation process can be a little confusing at first, particularly for developers who are not familiar with writing components.

However, creating ActiveX documents couldn't be easier. VB 5.0 includes a wizard for converting traditional forms-based VB projects into ActiveX documents. Unfortunately, VB 5.0-created ActiveX documents don't work the same as the more familiar server applications such as Word and Excel. Instead of creating embeddable objects, VB 5.0 uses ActiveX documents to run a VB application inside a container application such as Internet Explorer (IE) or the Microsoft Office Binder. Although Microsoft rewrote VB 5.0's Setup Wizard to handle packaging of ActiveX components for Internet and intranet use, the process is still complicated and almost always involves a lot of testing.

   Previous  [1]  2  Next 


Top Viewed ArticlesView all articles
No Jobs, No Excitement at Apple's Last Macworld Keynote

Apple CEO Steve Jobs made the right move in skipping out on his company's last appearance at Macworld: In a Tuesday keynote address at the conference, Apple had no interesting new products to sell, opting instead to spend mind-numbing amounts of time on ...

Where is Microsoft NetMeeting in Windows XP?

...

The Memory-Optimization Hoax

Don't believe the hype. At best, RAM optimizers have no effect. At worst, they seriously degrade performance. ...


Windows OSs Whitepapers Why SaaS is the Right Solution for Log Management

Related Events Virtualization Forum: Optimizing Storage, Networks, Desktops, and Security

Cloud Computing Forum: Integrating Software, Server and Storage as a Service into Your Enterprise IT Delivery Model

Virtualization Forum: Optimizing Storage, Networks, Desktops, and Security

Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Related Windows OSs Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2009 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing