业务整合 ACTIVEX OCX 问题 从Active Form 继承下来可以,从TAutoObject继承下来不可以! ( 积分: 100 )

  • 主题发起人 主题发起人 13708782004
  • 开始时间 开始时间
1

13708782004

Unregistered / Unconfirmed
GUEST, unregistred user!
下面是我们公司B/S ,和C/S业务整合需要 在IE中执行MiniShell.ocx,通过jscript 传参数
给MiniShell.ocx.miniShell.ocx 得到参数后,又启动: AA.EXE !

现在问题是:MiniShell.ocx 如果是Active Form 继承下来完全可以,但有356k,
我决定从TAutoObject继承下来,仅127k,但后在在本地计算机上完全正常,
从其他计算机访问,MiniShell.ocx的确是下载,也安装了,但就是没有反映(也就是IE中还有个未知obj的图标)!

请问各路朋友,发表下你们的意见!TAutoObject继承下来需要注意什么?


unit Miniddczp;
{$WARN SYMBOL_PLATFORM OFF}
interface

uses
DateUtils, SysUtils, shellapi, Registry, WINDOWS, ComObj, ActiveX, Project1_TLB, StdVcl;

type
TOBJMiniShell = class(TAutoObject, IMiniShell)
protected
procedure Set_LGUID(const Value: WideString)
safecall;
procedure Set_LUSER(const Value: WideString)
safecall;
{ Protected declarations }
public
FGUID: string;
FUSER: string;
end;

implementation

uses ComServ;


function ReadKey(): string;
var
Reg: TRegistry;
begin
result := '';
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_LOCAL_MACHINE

if Reg.OpenKey('/Software/' + C_MainKey, True) then
begin
result := Reg.ReadString('PATH');
Reg.CloseKey;
end;
finally
Reg.Free;
end;
end;


function GetDatePWD: string;
var
ADate: string;
i, Sum, WeekDay: integer;
begin
RESULT := '123';
end;

procedure TOBJMiniShell.Set_LGUID(const Value: WideString);
begin
FGUID := VALUE;
end;

procedure TOBJMiniShell.Set_LUSER(const Value: WideString);
var S: string;
begin
FUSER := VALUE + GetDatePWD();
// MESSAGEBOX(0, pchar(FUSER), 'Ìáʾ', mb_ok);
s := ReadKey();
if not fileexists(s) then
begin
MESSAGEBOX(0, '文件不存在...', '提示', mb_ok);
exit;
end;
ShellExecute(0, nil, PCHAR(S), PCHAR(FGUID + ' ' + FUSER), PCHAR(ExtractFilepath(S)), sw_ShowNormal);
end;

initialization
TAutoObjectFactory.Create(ComServer, TOBJMiniShell, Class_OBJMiniShell,
ciMultiInstance, tmApartment);
end.
 
下面是我们公司B/S ,和C/S业务整合需要 在IE中执行MiniShell.ocx,通过jscript 传参数
给MiniShell.ocx.miniShell.ocx 得到参数后,又启动: AA.EXE !

现在问题是:MiniShell.ocx 如果是Active Form 继承下来完全可以,但有356k,
我决定从TAutoObject继承下来,仅127k,但后在在本地计算机上完全正常,
从其他计算机访问,MiniShell.ocx的确是下载,也安装了,但就是没有反映(也就是IE中还有个未知obj的图标)!

请问各路朋友,发表下你们的意见!TAutoObject继承下来需要注意什么?


unit Miniddczp;
{$WARN SYMBOL_PLATFORM OFF}
interface

uses
DateUtils, SysUtils, shellapi, Registry, WINDOWS, ComObj, ActiveX, Project1_TLB, StdVcl;

type
TOBJMiniShell = class(TAutoObject, IMiniShell)
protected
procedure Set_LGUID(const Value: WideString)
safecall;
procedure Set_LUSER(const Value: WideString)
safecall;
{ Protected declarations }
public
FGUID: string;
FUSER: string;
end;

implementation

uses ComServ;


function ReadKey(): string;
var
Reg: TRegistry;
begin
result := '';
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_LOCAL_MACHINE

if Reg.OpenKey('/Software/' + C_MainKey, True) then
begin
result := Reg.ReadString('PATH');
Reg.CloseKey;
end;
finally
Reg.Free;
end;
end;


function GetDatePWD: string;
var
ADate: string;
i, Sum, WeekDay: integer;
begin
RESULT := '123';
end;

procedure TOBJMiniShell.Set_LGUID(const Value: WideString);
begin
FGUID := VALUE;
end;

procedure TOBJMiniShell.Set_LUSER(const Value: WideString);
var S: string;
begin
FUSER := VALUE + GetDatePWD();
// MESSAGEBOX(0, pchar(FUSER), 'Ìáʾ', mb_ok);
s := ReadKey();
if not fileexists(s) then
begin
MESSAGEBOX(0, '文件不存在...', '提示', mb_ok);
exit;
end;
ShellExecute(0, nil, PCHAR(S), PCHAR(FGUID + ' ' + FUSER), PCHAR(ExtractFilepath(S)), sw_ShowNormal);
end;

initialization
TAutoObjectFactory.Create(ComServer, TOBJMiniShell, Class_OBJMiniShell,
ciMultiInstance, tmApartment);
end.
 
求求走过,路过的帮我说说!
 
http://www.delphibbs.com/delphibbs/dispq.asp?lid=3290172
 
后退
顶部