高分求助(200分)

  • 主题发起人 主题发起人 lvheng
  • 开始时间 开始时间
L

lvheng

Unregistered / Unconfirmed
GUEST, unregistred user!
一个调用com服务端midichild窗口的程序,在D3中没有问题,在D5,D6中报错,
请给出原因,最好有代码,可以附件发送到lvhenghahaha@sina.com!万分感谢!


Serv端:
unit Serv;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
ComObj, ActiveX, CServ_TLB, StdVcl, cFrm, forms;

type
TiServ = class(TAutoObject, IiServ)
protected
{ Protected declarations }
procedure Run;safecall;
end;

implementation

uses ComServ;

procedure TiServ.Run;
begin
(TForm2.Create(application)).Show;//TForm2为一个midiForm
end;

initialization
TAutoObjectFactory.Create(ComServer, TiServ, Class_iServ,
ciMultiInstance, tmApartment);
end.

客户端:
unit Main;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, comobj, StdCtrls;

type
TForm1 = class(TForm)//MidiForm
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
a : OleVAriant;
begin
a := comobj.CreateOleObject('cServ.iServ');
a.run;
end;

end.
 
后退
顶部