MoLoadedModules Collection MoVersion Home
Properties Methods Events Return Codes Example

MoLoadedModules scans through the current process and determines which DLL's are loaded, what location they are being loaded from and finally determine all of the version information for each module.

This collection can easily be used as a diagnostic tool to report the version information of all the DLL's your application is using.

Properties

Property Name Property Description
Count As Integer Returns the number of MoVersion objects in collection.

Methods

Method Name Method Description
GetLoadedVersionInfo([ProcessID As Integer]) As HRESULT Scans through the running application and fills in the MoLoadedModules collection with MoVersion objects. These can then be used to determine the version characteristics of each loaded module. The optional parameter 'ProcessID' allows you to select the process to interogate, by default the current process is used.
Item(Index As Integer) As HRESULT Returns a specific member of a Collection object either by position. Currently the position can only be a numeric value. Item is the default property for a collection. Therefore, the following lines of code are equivalent:

Set MoVersion = MoLoadedModules(1)
Set MoVersion = MoLoadedModules.Item(1)
ForFreewareUseOnly() As Long This call exists in both the FREEWARE version of the control and the Professional version. This call need only be called in the FREEWARE version to stop the annoying dialog popping up. The reason for this function is too allow Freeware developers to have access to a fully functional control, but remind professional users that the FREEWARE version is only licensed for freeware solutions.

Events

Event Name Property Description
Control does not currently support events N/A

Return Codes

Error Code Value Description
NO_ERROR 0 No Error has occured.
NO_VERSION_INFO_FOUND 1001 The selected file does not have any embedded version information.
GUID_NOT_REGISTERED 1010 The selected COM GUID is not registered in the system.
PROGID_NOT_REGISTERED 1011 The selected COM ProgID is not registered in the system.
INTERNAL_EXCEPTION_THROWN 1098 This should never been seen! All the Mobiusware controls use Win32 exception handling to ensure your application cannot be killed by any problems in our control. If any problems are caught this error code is returned. Please report any sighting of this error to our support.

Example Use of MoLoadedModules in VB

Private Sub btnGetInformation_Click()
   Dim MoVersion As MoVersion
   Dim MoLoaded As MoLoadedModules
   Dim lRc As Long
   Dim i As Long
   Dim itmX As ListItem

   ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
   ' Generate a collection of versions for all of the loaded modules in '
   ' this process space                                                 '
   ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

   Set MoLoaded = New MoLoadedModules

   MoLoaded.ForFreewareUseOnly
   Call MoLoaded.GetLoadedVersionInfo

   Debug.Print "Module has " & MoLoaded.Count & " loaded modules"
   For Each MoVersion In MoLoaded
      '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
      ' Instead of using "For Each" you can also use:                   '
      ' For i = 1 To MoLoaded.Count                                     '
      ' Set MoVersion = MoLoaded.Item(i)                                '
      '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
      Set itmX = VersionInfoList.ListItems.Add(, , MoVersion.FileName)
      itmX.SubItems(1) = MoVersion.FileVersion
      itmX.SubItems(2) = MoVersion.CompanyName
      itmX.SubItems(3) = MoVersion.FullFileName
      Debug.Print MoVersion.FileName & " Description:"& MoVersion.Description
      Set MoVersion = Nothing
   Next

End Sub