看****啊
constructor TMultiTrdCmdGet.Create(aSqlStr:String;aThreadCount,aPacketRecCount: Integer;
aCDS: TClientDataSet);
begin
OleCheck(CoInitialize(nil));
**********************************
inherited Create(True);
FreeOnTerminate := True;
Resume;
end;
destructor TMultiTrdCDSGet.Destroy;
begin
CoUninitialize;
******************************************
inherited Destroy;
end;
或者只在过程中
procedure TMultiTrdCDSGet.DoFirst;
var
MyServ:IGMService;
vDatas,aError:OleVariant;
begin
OleCheck(CoInitialize(nil));
**********************************
MyServ:=CreateCOMObject(CLASS_GMService) as IGMService;
MyServ.MultiCDSGet(0,FCDS.ProviderName,0,0,vDatas,aError);
FRecCount := vDatas;
CoUninitialize;
******************************************
end;