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;
在别人的机器中运行时,我应该要判断别人的机器是否已经注册该控件。
也就是说在代码中怎么判断?谢谢!
在注册表里查看有没有该控件的信息.