在程序中怎样判断一个ActiveX控件是否已经注册?

解决方案 »

  1.   

    可以到组件面板上把那个ActiveX控件拉下来用,看会不会报错?
      

  2.   

    是在程序中,例如我的程序用到一个ActiveX控件,编译成可执行文件之后,
    在别人的机器中运行时,我应该要判断别人的机器是否已经注册该控件。
    也就是说在代码中怎么判断?谢谢!
      

  3.   

    不用判断,发布时把ACTIVEX带上,运行时重新注册就是了.
      

  4.   

    sorry,我看成签名的问题了.
    在注册表里查看有没有该控件的信息.
      

  5.   

    function ClassIsRegistered(const clsid: TCLSID): Boolean;varOleStr: POleStr;Reg: TRegInifile;Key, Filename: String;begin// First, check to see if there is a ProgID. This will tell if the// control is registered on the machine. No ProgID, control won'trunResult := ProgIDFromCLSID(clsid, OleStr) = S_OK;if not Result then Exit; ///Bail as soon as anything goes wrong.// Next, make sure that the file is actually there by rooting it out// of the registryKey := Format('\SOFTWARE\Classes\CLSID\%s', [GUIDToString(clsid)]);Reg := TRegInifile.Create;tryReg.RootKey := HKEY_LOCAL_MACHINE;Result := Reg.OpenKeyReadOnly(Key);if not Result then Exit; // Bail as soon as anything goes wrong.FileName := Reg.ReadString('InProcServer32', '', EmptyStr);if (Filename = EmptyStr) then // try another key for the file namebeginFileName := Reg.ReadString('InProcServer', '', EmptyStr);end;Result := Filename <> EmptyStr;if not Result then Exit;Result := FileExists(Filename);finallyReg.Free;end;end;