Application Security Testing: An Integral Part of DevOps
In Comparison between VB6 and .NET Objects Part 1 and Part 2, I covered the differences in the Properties Windows and in the Toolboxes respectively. With this article, I will concentrate on the differences in the Visual Basic 6 Project Explorer and the Visual Basic.NET Solution Explorer as well as explain the differences on how VB6 and VB.NET manages project files, and projects.
Let me start with explaining what a Project is in Visual Basic 6.
What Is a Project?
In Visual Basic 6, a project is the group of all the files that make up your program. These might include forms, modules (not attached to a form), graphics, and ActiveX controls.
Common File Extensions in a Visual Basic 6 Project
|.frx||Automatically generated file for every graphic in the project|
|.vbp||Visual Basic Project|
|.ctxUser||Control Binary File|
|.dca||Active Designer Cache|
|.ddf||Package and Deployment Wizard CAB Information File|
|.dep||Package and Deployment Wizard Dependency File|
|.dob||ActiveX Document Form File|
|.dox||ActiveX Document Binary Form File|
|.dsr||Active Designer File|
|.dsx||Active Designer Binary File|
|.dws||Deployment Wizard Script File|
|.log||Log file for Load Errors|
|.oca||Control TypeLib Cache File|
|.pag||Property Page File|
|.pgx||Binary Property Page File|
|.tlb||Remote Automation TypeLib File|
|.vbg||Visual Basic Group Project File|
|.vbl||Control Licensing File|
|.vbr||Remote Automation Registration File|
|.vbw||Visual Basic Project Workspace File|
|.vbz||Wizard Launch File|
|.wct||WebClass HTML Template|
Creating a New Project
When Visual Basic 6 starts, you may be prompted with the following screen:
Otherwise, if the VB6 IDE is already opened, you can select
- New Project, and you will get the following screen:
Types of Projects
You can create the following types of projects with Visual Basic 6:
|Standard EXE||Creates a standalone application.|
|ActiveX EXE||Creates an out-of-process ActiveX component.|
|ActiveX DLL||Creates an in-process ActiveX component.|
|ActiveX Control||Creates an ActiveX control, such as those that are shown in the Toolbox.|
|VB Application Wizard||Choose whether you want to use the Application Wizard to provide the framework for your standalone application. Although the Application Wizard can save you time once you understand the fundamentals of building applications with Visual Basic, building your first few projects from scratch will make it simpler to enhance the wizard-generated code.|
|VB Wizard Manager||Creates the framework for a wizard.|
|ActiveX Document DLL||Creates an in-process ActiveX Document. An ActiveX Document is an application that can be run inside a special container, such as Office Binder or Internet Explorer.|
|ActiveX Document EXE||Creates an out-of-process ActiveX Document.|
|Addin||Creates a special type of ActiveX server that can be used to enhance your Visual Basic Integrated Development Environment.|
|Data Project||Creates a Standard EXE project that includes both a Data Environment Designer and a Data Report Designer.|
|DHTML Application||Creates a Dynamic HTML project, which can be used to build DHTML Web pages.|
|IIS Application||Creates a project that can be used to build Active Server Pages.|
|VB Enterprise Edition Controls/VB Pro Edition Controls||Creates a standalone application project, but automatically includes Enterprise/Professional controls, such as the Remote Data control in the Toolbox.|
When Visual Basic 6 starts, you may be prompted with the following screen. Notice the Existing and Recent tabs of the New Project Dialog box.
- The Existing tab allows you to browse for a particular project (or project group).
- The Recent tab allows you to select a project from a list of most recently opened projects.
You also can choose File, Open Project from the Visual Basic 6 main menu to open a project.
You will encounter the following dialog box:
Saving and Naming Projects
By default, Visual Basic 6 creates a project, named Project1, for you once you create a new project. There are two ways of changing its name, however:
- Click on Project in the Project Explorer Window
- Type in a new project name in the Properties Window
Examine Figure 5.
- Select Project from the Visual Basic 6 main menu.
- Select Project1 properties...
- On the General Tab, type in the new Project name in the Project Name field.
Examine Figure 6.
Changing a Project's Properties
Following Method 2 in the previous section will also allow you to access the Project's properties dialog. The Project Properties dialog contains the following tabs:
Adding Files to a Project
You can add additional existing Forms or Modules to your current project through the use of the Project Explorer. To add something to your project, follow these steps:
- Right-click anywhere in the Project Explorer
- Point to Add
- Select the item you want to add to your project
Examine Figure 7.
Removing Files from a Project
To remove an item from the current project, follow these steps:
- Right-click on the particular item to remove (in the Project Explorer).
- Select Remove ItemName from the displayed menu. Examine Figure 8.
Note: In Figure 8, the name of the item to be removed is Form1.
A project group contains more than one project simultaneously. Project groups are denoted with a .vbg extension. Examine Figure 9.
You create a project group by selecting by following these steps:
- Select File from the main Visual Basic 6 menu.
- Click Add Project. Your Project Explorer should now resemble Figure 9.
You remove a project from the project group by following these steps:
- Select the project to remove in the Project Explorer.
- Select File from the main Visual Basic 6 menu.
- Click Remove Project. The chosen project will be removed from the project group.
Using the Project Explorer
You keep track of all files in your project with the Project Explorer. The Project Explorer provides a method to organize your project's files and allows you to access them individually in Form or Code View. The files that are included in the project are listed in the Project Explorer window.
There are three toolbar buttons at the top of the Project Explorer Window; examine Figure 10.
- View Code: You can select any project module and click on the View Code button. This will open the Code window for that particular module. This allows you to view any program code contained in the module.
- View Object: The View Object button lets you open the designer for a module. To view the designer for a particular form, select the module from the project list and click on View Object.
- Toggle Folders: The Toggle Folders button allows you to view all modules organised within folders for the specific type of module or view all modules without the organising folder.
Most of your interaction with the Project Explorer will be with its context menu. When you right-click on one of your project's files, you'll see a menu similar to Figure 11.
The context menu allows you to:
- View the file in a form window or code window
- View the properties of the file
- Add a form or module to the project
- Print the file
- Make the project explorer float or docked to the IDE
- Hide the project explorer
Managing Resource Files
Resource files store data, such as strings or icons that would normally be hard coded into your program or stored in a database. Although this may seem an unnecessary step, it does make a lot of sense for certain applications. Resource files are typically used in applications that are to be distributed in foreign countries. The resource file can contain strings and other data that are designed specifically for the country in which the application is used.
For example, you could use a resource file to contain all of the strings that are displayed by a program. String resources are given a numeric identifier, and each identifier can have one or more language-specific strings associated with it: one for Afrikaans, one for German, one for French, and so on. This is referred to as Localization because the computer's locale ID (LCID) is used to determine which string to use. That way, you can have a single program that will automatically utilise the languages of different countries and you don't have to create separate versions for Afrikaans, German, French, and so on.