home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue40 / COMCorn / PropForm.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-11-12  |  1.5 KB  |  66 lines

  1. unit PropForm;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, ActiveX;
  8.  
  9. type
  10.   TObjPropForm = class(TForm)
  11.     LblDesc: TLabel;
  12.     LblFile: TLabel;
  13.     Button1: TButton;
  14.     LblCLSID: TLabel;
  15.   private
  16.     { Private declarations }
  17.   public
  18.     { Public declarations }
  19.   end;
  20.  
  21. procedure ShowRegProps(const CLSID: TCLSID);
  22.  
  23. implementation
  24.  
  25. uses Registry, ComObj;
  26.  
  27. {$R *.DFM}
  28.  
  29. procedure ShowRegProps(const CLSID: TCLSID);
  30. var
  31.   Reg: TRegistry;
  32.   ClsStr, RegKey, S: string;
  33. begin
  34.   Reg := TRegistry.Create;
  35.   try
  36.     with TObjPropForm.Create(nil) do
  37.       try
  38.         Reg.RootKey := HKEY_CLASSES_ROOT;
  39.         ClsStr := GuidToString(CLSID);
  40.         LblCLSID.Caption := LblCLSID.Caption + ClsStr;
  41.         Reg.OpenKeyReadOnly('CLSID\' + ClsStr);
  42.         LblDesc.Caption := LblDesc.Caption + Reg.ReadString('');
  43.         Reg.CloseKey;
  44.         RegKey := 'CLSID\' + ClsStr + '\InprocServer32';
  45.         if Reg.KeyExists(RegKey) then Reg.OpenKeyReadOnly(RegKey)
  46.         else begin
  47.           RegKey := 'CLSID\' + ClsStr + '\LocalServer32';
  48.           if Reg.KeyExists(RegKey) then Reg.OpenKeyReadOnly(RegKey);
  49.         end;
  50.         if Reg.CurrentKey <> 0 then
  51.         begin
  52.           S := Reg.ReadString('');
  53.           Reg.CloseKey;
  54.           LblFile.Caption := LblFile.Caption + S;
  55.         end;
  56.         ShowModal;
  57.       finally
  58.         Free;
  59.       end;
  60.   finally
  61.     Reg.Free;
  62.   end;
  63. end;
  64.  
  65. end.
  66.