Object Module

Group:Declaration

Description:
An object module implements an ActiveX Automation object.

  • It has a set of Publicprocedures accessible from other macros and modules.

  • These public symbols are accessed via the name of the object module or an object variable.

  • Public Consts, Types, arrays, fixed length strings are not allowed.

  • An object module is similar to a class module except that one instance is automatically created. That instance has the same name as the object module's name.

  • To create additional instances use:

Dim 
 Obj As objectname
Set 
 Obj = New objectname

See Also:Class Module, Code Module, Uses.

Example:

'A.WWB
'#Uses "System.OBM"
Sub 
 Main
Debug.PrintHex(System.Version)
EndSub
 
'System.OBM
'File|New 
 Module|Object 
 Module
'Edit|Properties|Name=System
Option 
 Explicit
DeclareFunction 
 GetVersion16 Lib "Kernel" _
Alias "GetVersion" () As Long
DeclareFunction 
 GetVersion32 Lib "Kernel32" _
Alias "GetVersion" () As Long
 
PublicFunction 
 Version() As Long
If 
 Win16 Then
Version = GetVersion16
Else
Version = GetVersion32
EndIf

EndFunction