Creating the CAbout ActiveX component
This is the component that shows the About Box window. Visual Basic already includes a form template for About Box windows, so we’ll use this template and make a couple of changes.
Reopen your f90VBGUI Visual Basic project, click on the Project menu and select the Add Form option. This opens a dialog showing you several form templates ready to be used (Figure 10). Select the template named About Dialog and click open. This adds a new form to your project. Change the name of the form to FormAbout and set the form’s caption and the text in the label controls as shown in Figure 2 (or to anything you want):
Next, find the form’s Form_Load event handler, which should look like this:
Private Sub Form_Load()
Me.Caption = "About " & App.Title
lblVersion.Caption = "Version " & App.Major & "." & _
App.Minor & "." & App.Revision
lblTitle.Caption = App.Title
End Sub
This event handler fills out the labels in the form using information that is specific to Visual Basic programs. We don’t need this stuff here, because we have set the content of the labels manually. So you can comment out the content of this event handler:
Private Sub Form_Load()
'Me.Caption = "About " & App.Title
'lblVersion.Caption = "Version " & App.Major & "." & _
' App.Minor & "." & App.Revision
'lblTitle.Caption = App.Title
End Sub
The ActiveX class we’ll use to wrap this form is even easier than CError. Add a new class to the project (select Project from the menu bar and then click on Add Class Module). Change the name of the class to CAbout and make sure the instancing property of the class is set to MultiUse. Add the code shown in Sample Code 5 to the class.
That was simple, wasn’t it? Now let’s write a Fortran subroutine that uses our new ActiveX object. We add this subroutine to the module f90VBGUIUtils (Sample Code 6)
Creating the CInput ActiveX component