Scalabium Software

SMExport advertising
Knowledge for your independence'.
Home Delphi and C++Builder tips


#169: How can I retrieve the file name from string with ActiveX/OLE class?

Today I want to post the method how you may get the file name for dll/ocx/exe etc where implemented some ActiveX/OLE class

Imagine you work with some class (ADODB.Connection, for example) and want to see what other interfaces are implemented in same container. To solve this task you need get the file name where original interface ADODB.Connection implemented.
Only when you'll find the file name, you may load this file to any OLE Viewer and iterate the all interfaces/methods/properties etc

The information about registered ActiveX stored ion registry in HKEY_CLASSES_ROOT. So all what we need is to find the class by name

function GetFileNameFromOLEClass(const OLEClassName: string): string;
var
  strCLSID: string;
  IsFound: Boolean;
begin
  IsFound := False;
  with TRegistry.Create do
    try
      RootKey := HKEY_CLASSES_ROOT;
      if OpenKey(OLEClassName + '\CLSID', False) then
      begin
        strCLSID := ReadString('');
        CloseKey;
        if OpenKey('CLSID\' + strCLSID + '\InprocServer32', False) then
          IsFound := True
        else
        if OpenKey('CLSID\' + strCLSID + '\LocalServer32', False) then
          IsFound := True
        else
          IsFound := False;

        if IsFound then
        begin
          Result := ReadString('');
          CloseKey;
        end
        else
          Result := '';
      end
    finally
      Free
    end
end;

For example, to find the dll where ADODB implemented:

  s := GetFileNameFromOLEClass('ADODB.Connection');
  ShowMessage(s);

or

  ShowMessage(GetFileNameFromOLEClass('ClearCase.Application'));

or

  ShowMessage(GetFileNameFromOLEClass('PdxViewA.TScalabiumParadoxReader'));


Published: December 6, 2005

See also
 
SMReport
ABA Database Convert
Paradox ActiveX
ABA Picture Convert
Clarion Viewer
Database Information Manager
Excel Reader (dll)
Paradox to Text converter
SMExport suite
Protected Storage Viewer
 
 


Contact to webmaster

 

Borland Software Code Gear Scalabium Delphi tips

Copyright© 1998-2017, Scalabium Software. All rights reserved.
webmaster@scalabium.com

SMExport advertising