W
wingofdark
Unregistered / Unconfirmed
GUEST, unregistred user!
CoInitialize(nil)失败,我在ISAPI程序中创建COM没有反应,在C/S下可以
procedure TwmMain.wmMainwaLoginAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
lIWebServer: IWebServer;
begin
OleCheck(CoCreateInstance(CLASS_WebServer, nil, CLSCTX_INPROC_SERVER or
CLSCTX_LOCAL_SERVER,IID_IWebServer, lIWebServer));
在这里总是创建不了。
end;
//另在此COM实现类中初始化的时候,COM中的AutoClass为什么不是我的类名TWebBizServer?
initialization
TMultiAutoObjectFactory.Create(ComServer, TWebBizServer, CLASS_WebServer,
ciMultiInstance, tmApartment);
正常的话,打开Home.htm,输入用户名:zs,可以登录,屏幕显示:logined,否则显示: can not to login
如果在创建COM时失败,则显示:interface is null
错误关键代码:单元名:UnitCom.pas,另此单元在初始化的时候失败
procedure TWebModuleTestComm.WebModule1waLoginAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
lITestComm : ITestComm;
a, b, c : wideString;
begin
try
OleCheck(CoCreateInstance(CLASS_TestComm, nil, CLSCTX_INPROC_SERVER or
CLSCTX_LOCAL_SERVER,IID_ITestComm, lITestComm)); 在此处有错误
a := 'zs';
if lITestComm <> nil then
begin
if lITestComm.Login(a,b,c) then
Response.content := 'yes logined'
else
Response.content := 'can not to login';
end
else
Response.content := 'interface is null';
finally
CoUninitialize;
end;
end;
procedure TwmMain.wmMainwaLoginAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
lIWebServer: IWebServer;
begin
OleCheck(CoCreateInstance(CLASS_WebServer, nil, CLSCTX_INPROC_SERVER or
CLSCTX_LOCAL_SERVER,IID_IWebServer, lIWebServer));
在这里总是创建不了。
end;
//另在此COM实现类中初始化的时候,COM中的AutoClass为什么不是我的类名TWebBizServer?
initialization
TMultiAutoObjectFactory.Create(ComServer, TWebBizServer, CLASS_WebServer,
ciMultiInstance, tmApartment);
正常的话,打开Home.htm,输入用户名:zs,可以登录,屏幕显示:logined,否则显示: can not to login
如果在创建COM时失败,则显示:interface is null
错误关键代码:单元名:UnitCom.pas,另此单元在初始化的时候失败
procedure TWebModuleTestComm.WebModule1waLoginAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
lITestComm : ITestComm;
a, b, c : wideString;
begin
try
OleCheck(CoCreateInstance(CLASS_TestComm, nil, CLSCTX_INPROC_SERVER or
CLSCTX_LOCAL_SERVER,IID_ITestComm, lITestComm)); 在此处有错误
a := 'zs';
if lITestComm <> nil then
begin
if lITestComm.Login(a,b,c) then
Response.content := 'yes logined'
else
Response.content := 'can not to login';
end
else
Response.content := 'interface is null';
finally
CoUninitialize;
end;
end;