In-Depth

Viva la VB!

Hi, my name's Karl, and I use Classic VB. My "problem" is, you see, Classic VB still does the job for me. In some circles, it's hard to feel more of an outcast and down on your luck than to be one of those Luddites who haven't yet adopted the inevitable. Thankfully, those circles are mighty tight -- some might stoop to calling them inbred -- and easy to avoid out here in the real world.

Long-time readers might remember that I used to write a variety of columns for Visual Studio Magazine (and its predecessor, Visual Basic Programmer's Journal) focused on practical problem solving. Apparently, there are still a lot of folks (see Figure 1) out there still running into practical problems with Classic VB, so Patrick has asked me to return with a focus on, uh, okay, won't call it "the past," but...

There are new challenges in the world of Classic VB, and probably none is as daunting as supporting Vista. (Insert mental joke here about Microsoft's troubles -- not even I'm that gratuitous. [O rly? -- Eds.]) I hope to start off this column with a series of practical articles revolving around getting VB6 to run on Vista, including the latest service packs, and actually progressing to the point of being productive.

Once we have VB6 up and running, we'll turn the focus to Microsoft's promise of support for the runtime, the IDE, and numerous other components, making sure that native VB code runs as it should. And it wouldn't be a Vista discussion at all if we didn't plumb the mysteries of the dreaded security model, and ways to get around, or otherwise live with, it.


[Click on image for larger view.]

Don't care at all about Vista? (You're far from alone there!) Don't worry. I'm only focused on it at the moment because there does seem to be a need to get some baseline survival information out there. I plan to return to the practical, drop-in ready, solutions that folks seemed to enjoy most in my old columns.

Don't Hose That Hardware
To get us started on the path to supporting Vista, or really any other operating system you'd really rather not actually install on useful hardware, I'll recommend heartily a new tool that Microsoft has recently decided to provide totally free -- Virtual PC 2007. Get it. No single tool, in my recollection, has ever made life easier for the multiplatform developer.

It didn't take me long to realize just how useful VPC is. In the first week of playing with it, I had virtual machines (VMs) built for platforms ranging from Windows 3.1 to Vista, and everything in-between. I could easily test any of the code on my hard drive, using a single KVM set! I can run identical tests in Windows 95 and XP or Vista by just Alt-Tabbing between windows. Absolutely amazing and totally liberating.

The first thing you'll want to do when setting up a VM, upon finishing the installation of a new operating system, will be to install the Virtual Machine Additions. Without these, the mouse becomes captured by the VM. (To escape this mouse capture, during installation, hold down the right Alt key while moving the mouse outside the VM window.)

Probably the coolest feature of all is that you can set a VM to use "Undo Disks" -- that is, nothing is committed to the virtual hard disk (VHD) image(s) until you close down the machine, and you are asked whether to write the changes. This allows you to boot to a "clean machine" at will. Just burn copies of your VHDs to DVD as soon as you feel they are ready to serve as a baseline platform. There are tutorials on the Web that describe how to optimize and reduce the final archived VHD size, but the basics are:

  • Attach to the VHD from a distinct VM, so that it's drive D:
  • Delete the swap file (it will be recreated when needed).
  • Defragment the VHD.
  • Run VPCs "Virtual Disk Wizard" against the VHD to compact the image.

Back to the Future?
I will not be writing about Anything .NET in this column. When I make references to VB, you can be assured I'm speaking of the Classic variety -- VB6 and earlier. If I find need to refer to latter bits that bear that name, I'll call it by something (Fred?) that will leave no confusion in your mind what I'm speaking of. Until next time...

About the Author

Karl E. Peterson wrote Q&A, Programming Techniques, and various other columns for VBPJ and VSM from 1995 onward, until Classic VB columns were dropped entirely in favor of other languages. Similarly, Karl was a Microsoft BASIC MVP from 1994 through 2005, until such community contributions were no longer deemed valuable. He is the author of VisualStudioMagazine.com's new Classic VB Corner column. You can contact him through his Web site if you'd like to suggest future topics for this column.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube