Page tree
Skip to end of metadata
Go to start of metadata

On this page:

Target audience:

CAST Administrators

Summary: this page provides detailed information about CAST's support for the Visual Basic technology.

Detailed technology support

Language version
Supported

VB 4 32 bits

(tick)
VB 5(tick)
VB 6(tick)
Only Microsoft Visual Basic is supported.

Required third-party software

To successfully deliver and analyze Visual Basic code, the following third-party software is required:

Install on workstation running the DMT (for extraction)
Install on workstation running CMS (for analysis)

Nothing required

Note that the CAST Delivery Manager Tool simply requires the location of the VB files for extraction and packaging.
If your CAST schemas are hosted on an Oracle Server RDBMS, you must ensure that a 32-bit Oracle Client (in addition to the 64-bit Oracle client that is already required) is installed and configured on the machine on which you want to use CMS to run the VB analysis. This requirement is due to the fact that the VB analyzer is delivered as 32-bit only (see paragraph below). You can refer to this third-party guide on installing a 32-bit and 64-bit Oracle Client on the same machine (this guide is provided "as-is" without guarantee or support from CAST).

Visual Basic analyzer and 64-bit compatibility

The current release of CAST AIP is 64-bit compliant and therefore requires a 64-bit compatible machine for installation purposes - see Supported Platforms). However, the CAST Visual Basic analyzer contains components that cannot be re-factored to 64bit and therefore CAST has had to deliver these components as 32-bit modules. This has been achieved by placing the required components in the Vb6 folder located at the root of the CAST installation location.

Analysis of VB source code will proceed without issue, however, please note the following:

  • Because the Visual Basic analyzer is delivered in 32-bit, it is subject to the same memory limitations as any other 32-bit application.
  • If you manually modify any configuration files (such as the default CAST environment profiles or other .INI files), you must ensure that you modify them in the <CAST_install_folder>\Vb6\configuration folder, rather than in the identical file located in the standard <CAST_install_folder>\configuration folder. If you have upgraded from a previous release of CAST AIP (i.e. CAST AIP ≤ 7.3.x) that was not 64-bit compliant, you MUST ensure that you manually transfer these changes from the relevant files in the <CAST_install_folder>\configuration folder in the previous install, to the relevant files in the <CAST_install_folder>\Vb6\configuration folder.
  • You can still manually create Execution Units if you find that you are receiving out of memory errors when attempting to run a large Visual Basic analysis.

Visual Basic objects and links

The following section lists the objects and links between objects that the Visual Basic analyzer is capable of detecting and storing in the CAST Analysis Service:

Objects

Class Module

Constant

Control

Designer

Event

External Function

External Sub

Form

Function

MDI Form

Module

Control Project

EXE Project

Group Project

OLE DLL Project

OLE Exe Project

Get Property

Let Property

Page Property

Set property

Sub

VB Subset

User Control

User Document

Variable

Com CoCLass

Com Disp Interface
Com Interface

Com Method
Com Property
Com Get Property
Com Put Property
Com Put Ref Property

Com Type Lib
Com External Type Lib

Link TypeWhen is this type of link created?
Call- When calling a VB or a COM function (sub, function, property get, let set, com method, com prop put, prop putref, prop get) except system functions (functions from VB, VBA or VBRUN DLLs)

- When calling a VB or a COM event

- When the return type of a function is not a standard one

Here is a sample that shows one of these links.

Private Sub MySub(i As Integer)

  'Do Whatever

  End Sub

Private Sub Command1_Click()
 
  Dim j As Integer

  MySub (j)

End Sub

This will result in the following view:

Raise- When raising an event

In the following sample, we have a class (Class1) that defines an event (Gong) and a method (MyMethod). When MyMethod is called, we raise an event.

Event Gong()

Public Sub MyMethod()

RaiseEvent Gong

End Sub

This will result in the following view (includes only event relevant links):

Use

There is also a Form (Form1) that has the button (Command1). Here’s the code of this Form:

Private WithEvents mHandler As Class1

Private Sub Command1_Click()

   Set mHandler = New Class1

   mHandler.MyMethod

End Sub

Private Sub mHandler_Gong()

MsgBox "Gong !"

End Sub

- When declaring a user data-type, link with the non standard members of this user data-type

- When referencing a non standard type member of a user data-type variable

- When accessing a variable

Rely On- When declaring a variable of a non standard type

- When declaring a function return value of a non standard type

Inherit- When a user control inherits from a non standard type

In this sample, the user control “UserControl1” is used in the form “Form1”

- When implementing an event using WithEvents statement

Notes

The following section lists technical and functional aspects with regard to analysis of Visual Basic source code:

Referencing through UNC path

A DLL Project with a local path is not matched when referenced through UNC path. When VB project "A" references a DLL "B" through a UNC path and the VB project "B" corresponding to the referenced DLL "B" has a local path using a drive letter, the VB analyzer does not match DLL "B" with project "B" and therefore does not create links between "A" and "B".

Integers

The VB analyzer's Inference Engine does not take integers into account. When an integer participates in the construction of a string ( strC1 = "Inference.clsVB" + CStr( i ) ), the Inference Engine does not find the true value. In the previous example, it finds only "Inference.clsVB" and not "Inference.clsVB1"," Inference.clsVB2".

Unresolved OCX Method Calls

Calls to the methods listed below are not detected by the VB Analyzer. These methods are dynamically added to OCA files the first time Visual Basic is launched. These methods only exist for graphical components contained in OCXs.

Method Name

Description

BSTR Name()

Returns the name used in code to identify an object.

short index()

Returns/sets the number identifying a control in a control array.

single Left()

Returns/sets the distance between the internal left edge of an object and the left edge of its container.

void Left([in] single rhs)

Returns/sets the distance between the internal left edge of an object and the left edge of its container.

single Top()

Returns/sets the distance between the internal top edge of an object and the top edge of its container.

void Top([in] single rhs)

Returns/sets the distance between the internal top edge of an object and the top edge of its container.

single Width()

Returns/sets the width of an object.

void Width([in] single rhs)

Returns/sets the width of an object.

single Height()

Returns/sets the height of an object.

void Height([in] single rhs)

Returns/sets the height of an object.

VARIANT_BOOL Visible()

Returns/sets a value that determines whether an object is visible or hidden.

void Visible([in] VARIANT_BOOL rhs)

Returns/sets a value that determines whether an object is visible or hidden.

IDispatch* Parent()

Returns the object on which this object is located.

short DragMode()

Returns/sets a value that determines whether manual or automatic drag mode is used.

void DragMode([in] short rhs)

Returns/sets a value that determines whether manual or automatic drag mode is used.

Picture* DragIcon()

Returns/sets the icon to be displayed as the pointer in a drag-and-drop operation.

void DragIcon([in] Picture* rhs)

Returns/sets the icon to be displayed as the pointer in a drag-and-drop operation.

void DragIcon([in] Picture* rhs)

Returns/sets the icon to be displayed as the pointer in a drag-and-drop operation.

BSTR Tag()

Stores any extra data needed for your program.

void Tag([in] BSTR rhs)

Stores any extra data needed for your program.

VARIANT_BOOL Enabled()

Returns/sets a value that determines whether an object can respond to user-generated events.

void Enabled([in] VARIANT_BOOL rhs)

Returns/sets a value that determines whether an object can respond to user-generated events.

VARIANT_BOOL TabStop()

Returns/sets a value indicating whether a user can use the TAB key to give the focus to an object.

void TabStop([in] VARIANT_BOOL rhs)

Returns/sets a value indicating whether a user can use the TAB key to give the focus to an object.

short TabIndex()

Returns/sets the tab order of an object within its parent form.

void TabIndex([in] short rhs)

Returns/sets the tab order of an object within its parent form.

IDispatch* Object()

Returns an object in a control.

long HelpContextID()

Specifies the default Help file context ID for an object.

void HelpContextID([in] long rhs)

Specifies the default Help file context ID for an object.

long WhatsThisHelpID()

Returns/sets an associated context number for an object.

void WhatsThisHelpID([in] long rhs)

Returns/sets an associated context number for an object.

IDispatch* Container()

Returns the container of an object.

void Container([in] IDispatch* rhs)

Returns the container of an object.

VARIANT_BOOL CausesValidation()

Returns/sets whether validation occurs on the control which lost focus.

void CausesValidation([in] VARIANT_BOOL rhs)

Returns/sets whether validation occurs on the control which lost focus.

DataBindings* DataBindings()

Returns/sets a DataBindings collection object that collects the bindable properties that are available to the developer.

BSTR ToolTipText()

Returns/sets the text displayed when the mouse is paused over the control.

void ToolTipText([in] BSTR rhs)

Returns/sets the text displayed when the mouse is paused over the control.

void SetFocus()

Moves the focus to the specified object.

void ZOrder([in] VARIANT Position)

Places a specified object at the front or back of the z-order within its graphical level.

void Move(
[in] single Left,
[in] VARIANT Top,
[in] VARIANT Width,
[in] VARIANT Height)

Moves an object.

void Drag([in] VARIANT Action)

Begins, ends, or cancels a drag operation of any object except Line, Menu, Shape, and Timer.

void ShowWhatsThis()

Displays a selected topic in a Help file using the What's This popup provided by Windows 95 Help.

Miscellaneous issues

  • The VB analyzer searches for server object names in all literal strings and embedded SQL in Visual Basic, taking into account normalized. While this technique searches for and finds all real schema/database object references, it may also find incorrect references. For example, literal strings, such as user messages or menu options, may contain the names of database or schema objects and in such cases, incorrect references may be found. The VB analyzer will NOT search for, NOR find the names of stored procedures, tables or views that are constructed dynamically by concatenating parts of their names.
  • The VB analyzer does not scan binary files, as a result, it will NOT detect references hidden in these files.
  • If you declare a generic object variable (such as an object) and assign an object to it by using the Set statement, the VB analyzer will NOT detect references to a method of this object.
  • Collections and arrays are not supported during resolution via these object types. In other words, these objects can be seen in the Graphical View, but when a call is made via a collection or an array, the elements located on the right of the call are not found: MyClass.MyMethod() is fully supported, but in MyArrayOfClass( n ).MyMethod() no link will be detected to MyClass nor to MyMethod. A link will, however, be detected to MyArrayOfClass. This limitation only applies for collections or variant/object arrays. For arrays whose type is already known when the array is declared, the link to the method will be detected.
  • Control groups are supported as follows: only the group is displayed by CAST - each element in the group cannot be seen.
  • Win32 calls from the VB code are represented by imported functions.
  • Binary files are not analyzed.

Inference Engine limitations

Because of a limitation in the Inference Engine for the VB analyzer, the link between "sub1" and the method "Method" (in the example below) will not be created where a parameter of a parametrized method ("MsgBox" in this case) calls a dynamic function (i.e. a link retrieved by the Inference Engine). For example: Sub Sub1()Dim var as ObjectSet o = CreateObject( "A.B")MsgBox o.Method()End Sub

Links from VB objects to COM objects

Links to COM methods implemented in an OCX library or C++ DLL are not created while analyzing VB source code having references to these methods. these links can, however, be created manually using a Reference Pattern.

Syntax

When the line continuation character, i.e. the underscore ( _ ), is used after a period ( . ), the VB analyzer gives a syntax error during analysis of such code. Example:

 

frmToursPerdusManqueConducteur.flexDonnees. _
                                       TextMatrix(ii, 7) = vf_NbTPJour
---------------------------------------

As a consequence, the object containing this code is not analyzed. To avoid the error, either remove the line continuation character and write the code on one line, or separate the line at a different location, not after a period. The use of the line continuation character after other characters than the period does not cause a syntax error.

VB Standard APIs

Standard VB APIs (VBA, VB, VBRUN) delivered with the various versions of Visual Basic are too big to be analyzed during each analysis. Consequently these APIs have been pre-parsed and the underlying classes are packaged with the analyzer. The VB APIs are then loaded depending on the version and redeployed on demand during the analysis. 

This has the following consequences:

  • VB standard objects are not stored in the Analysis Service.
  • Even if references to standard VB objects are resolved by the analyzer, corresponding links are not traced and consequently not stored.
  • For the CreateObject method and CreateInstance method, the analyzer will create a link between the caller of these methods and the COM CoClass of the first parameter of these methods.

 

  • No labels