Displaying Source Code(s)
|
|
ProgIDInfo ObjectXML Advertising
--------------------------------------------------------------------------------
Description : ProgIDInfo returns information about COM objects
installed on the server. ProgIDInfo is useful for determining
the CLSID, typeLib, current version, dll name, path to dll,
library description, etc... for one or more entered class
strings. ProgIDInfo is an extremely helpful tool for
administrators anxious to learn about the limits of their
environment by probing the Windows registry for information
about available com objects. Properties ================ No
Exposed Properties Methods ================
LoadProgID(sProgramID) Set object = obj.LoadProgID(sProgramID)
Retrieves information about the class string entered in the
sProgramID argument. Returns a Program object. The Program
object returns seven read only properties. Each property
contains information about the entered class string: Program
Object properties: ========================== All program object
properties return "undetermined" if the information cannot be
found in the registry for that specified com object. Description
returns the readable description for the entered com object.
example: for Scripting.FileSystemObject, Description property
returns: "Scripting Runtime Library" ClsID returns the class id
for the entered com object as string. ProgID returns the current
version specific program id for the entered com object as
string. For example, if you enter "Excel.Application" and you
have Excel 2000 on the server, the ProgID property of the
program object will return "Excel.Application.9" which is Excel
2000's class string. Path returns the absolute path to the COM
object being called on the server as string. Useful for fixing
permissions on COM objects since you'll need to know where the
dll is to set it's permissions. TypeLib returns a GUID as string
representing the object's type library. Useful with the metadata
tag. Version returns version information as string for the
specified com object only if the Path property returns a valid
path. DLLName returns the name of the dll or executable being
called with that class string as a string. Includes the
extension. You can call the LoadProgID method repeatedly without
having to create a new instance of the class. A new Program
object will be automatically created for each instance.
<%
Class Program
Public Description, ClsID, ProgID, Path, TypeLib, Version,
DLLName
End Class
Class ProgIDInfo
Private WshShell, sCVProgID, oFSO
Private Sub Class_Initialize()
On Error Resume Next
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
End Sub
Private Sub Class_Terminate()
If IsObject(WshShell) Then Set WshShell = Nothing
If IsObject(oFSO) Then Set oFSO = Nothing
End Sub
Private Function IIf(ByVal conditions, ByVal trueval, ByVal
falseval)
If CBool(conditions) Then IIf = trueval Else IIf = falseval
End Function
Public Function LoadProgID(ByVal sProgramID)
Dim sTmpProg, oTmp, sRegBase, sDesc, sClsID
Dim sPath, sTypeLib, sProgID, sVers, sPathSpec
If IsObject(WshShell) Then
On Error Resume Next
sCVProgID = WshShell.RegRead("HKCR" & _
sProgramID & "CurVer")
sTmpProg = IIf(Err.number = 0, sCVProgID, sProgramID)
sRegBase = "HKCR" & sTmpProg
sDesc = WshShell.RegRead(sRegBase & "")
sClsID = WshShell.RegRead(sRegBase & "clsid")
sRegBase = "HKCRCLSID" & sClsID
sPath = WshShell.RegRead(sRegBase & "InprocServer32")
sPath = WshShell.ExpandEnvironmentStrings(sPath)
sTypeLib = WshShell.RegRead(sRegBase & "TypeLib")
sProgID = WshShell.RegRead(sRegBase & "ProgID")
sVers = oFSO.getFileVersion(sPath)
sPathSpec = Right(sPath, Len(sPath) - _
InStrRev(sPath, ""))
Set oTmp = New Program
oTmp.Description = sDesc
oTmp.ClsID = IIf(sClsID <> "", sClsID, "undetermined")
oTmp.Path = IIf(sPath <> "", sPath, "undetermined")
oTmp.TypeLib = IIf(sTypeLib <> "", _
sTypeLib, "undetermined")
oTmp.ProgID = IIf(sProgID <> "", _
sProgID, "undetermined")
oTmp.DLLName = IIf(sPathSpec <> "", _
sPathSpec, "undetermined")
oTmp.Version = IIf(sVers <> "", sVers, "undetermined")
Set LoadProgID = oTmp
Else
Set LoadProgID = Nothing
End If
End Function
End Class
%>
|
|
|