L
landina
Unregistered / Unconfirmed
GUEST, unregistred user!
以下同样的代码我在可执行文件中运行正常,可是在Dll中系统提示我CoInitialize尚未初始化
请问为什么?
procedure TfrmEmployee.FormCreate(Sender: TObject);
var
EmployeeData,Cols:OleVariant;
employee:IEmployee;
RowCount,i,j:Integer;
begin
try
employee := CoEmployee.CreateRemote('landin');
// employee := CoEmployee.Create;
// employee.GetAllEmployeeData(EmployeeData,Cols);
except
messagedlg('连接远程应用服务器错误!',mtwarning,[mbOK],0);
end;
if employee <> nil then
begin
try
RowCount := VarArrayHighBound(EmployeeData,1);
sgEmployee.ColCount := Cols;
sgEmployee.RowCount := Rowcount;
for i := 0 to RowCount-1 do
for j := 0 to sgEmployee.ColCount -1 do
begin
sgEmployee.Rows.Add(EmployeeData[i+1,j]);
end;
except
messagedlg('数据格式错误!',mtwarning,[mbOK],0);
end;
end;
end;
请问为什么?
procedure TfrmEmployee.FormCreate(Sender: TObject);
var
EmployeeData,Cols:OleVariant;
employee:IEmployee;
RowCount,i,j:Integer;
begin
try
employee := CoEmployee.CreateRemote('landin');
// employee := CoEmployee.Create;
// employee.GetAllEmployeeData(EmployeeData,Cols);
except
messagedlg('连接远程应用服务器错误!',mtwarning,[mbOK],0);
end;
if employee <> nil then
begin
try
RowCount := VarArrayHighBound(EmployeeData,1);
sgEmployee.ColCount := Cols;
sgEmployee.RowCount := Rowcount;
for i := 0 to RowCount-1 do
for j := 0 to sgEmployee.ColCount -1 do
begin
sgEmployee.Rows.Add(EmployeeData[i+1,j]);
end;
except
messagedlg('数据格式错误!',mtwarning,[mbOK],0);
end;
end;
end;