Y
yjhzzgl
Unregistered / Unconfirmed
GUEST, unregistred user!
我想在程序中打开cad划的图,可就是不行,请大富翁指教!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,activex,comobj,autocad_tlb;
type
TForm1 = class(TForm)
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 acadConnect,acadApp:OleVariant;
begin
try
acadConnect:=GetActiveOleObject('AutoCAD.Application');
except
acadApp:=CreateOleObject('AutoCAD.Application');
end;
acadConnect.Visible:=True;
acadConnect:=acadApp.ActiveDocument;
acadApp.Documents.Open('D:/Program Files/AutoCAD 2004/Sample/wilhome.dwg',true,'');
end;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,activex,comobj,autocad_tlb;
type
TForm1 = class(TForm)
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 acadConnect,acadApp:OleVariant;
begin
try
acadConnect:=GetActiveOleObject('AutoCAD.Application');
except
acadApp:=CreateOleObject('AutoCAD.Application');
end;
acadConnect.Visible:=True;
acadConnect:=acadApp.ActiveDocument;
acadApp.Documents.Open('D:/Program Files/AutoCAD 2004/Sample/wilhome.dwg',true,'');
end;
end.