首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

Delphi 统制 CodeSoft 报错 Method 'Dialogs' not supported by automation obj

2013-01-05 
Delphi 控制 CodeSoft 报错 Method ɽialogs' not supported by automation object本帖最后由 t

Delphi 控制 CodeSoft 报错 Method 'Dialogs' not supported by automation object
本帖最后由 tao60 于 2011-02-22 17:26:37 编辑 Method 'Dialogs' not supported by automation object


unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,ShellApi,Comobj,OleServer, StdCtrls, LabelManager2_TLB, jpeg,
  ExtCtrls,Clipbrd, DB, ADODB;

type
  TForm1 = class(TForm)
    OpenDialog1: TOpenDialog;
    CheckBox1: TCheckBox;
    Image1: TImage;
    Button7: TButton;
    Button8: TButton;
    Button9: TButton;
    Button1: TButton;
    procedure Button7Click(Sender: TObject);
    procedure Button8Click(Sender: TObject);
    procedure Button9Click(Sender: TObject);
    procedure Preview();
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  BarApp,BarDoc,BarVars:Variant;
  OpenEd:boolean;
{
  MyApp:LabelManager2_TLB.Application;
  MyDoc:LabelManager2_TLB.Document;
  MyVars:LabelManager2_TLB.Variables;
}
implementation

{$R *.dfm}
procedure TForm1.Preview();
begin
  if not opened then
    exit;
  BarDoc.CopyToClipboard;
  image1.Picture.Bitmap.Assign(Clipboard);
end;

{预览}
procedure TForm1.Button1Click(Sender: TObject);
begin
  Preview;
end;

{打开并打印}
procedure TForm1.Button7Click(Sender: TObject);
Var 
  slab:string;
begin
  if not opendialog1.Execute then
    exit;
  slab:=opendialog1.FileName;

  BarApp := CreateOleObject('lppx.Application');
  opened:=true;
  BarApp.Visible:=false;
  BarDoc:=BarApp.ActiveDocument;
  BarVars:=BarDoc.Variables;
  BarDoc.Open(slab);
  BarDoc.Variables.Item('Data1').Value:='ABCD';
  BarDoc.Variables.Item('Data2').Value:='111';
  BarDoc.Variables.Item('Data3').Value:='111ABCD';
  Bardoc.Printlabel(1);
  BarDoc.FormFeed;
End;

{设置打印机}
procedure TForm1.Button8Click(Sender: TObject);
begin
  if not opened then
    exit;
  BarApp.Dialogs.Item(lppxPrinterSelectDialog).Show;
  {================================================}
  {运行到这一句出错:Method 'Dialogs' not supported by automation object}
  {================================================}

end;

{关闭}
procedure TForm1.Button9Click(Sender: TObject);
begin


  close;
end;

{窗体关闭}
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  if not opened then
    exit;
  Bardoc.Close;
  BarApp.Quit;
end;

{窗体创建}
procedure TForm1.FormCreate(Sender: TObject);
begin
  opened:=false;
end;



end.


[解决办法]
很显然,你的barapp不支持dialog操作~~
[解决办法]
http://kye_jufei.download.csdn.net/
[解决办法]
自动化对象不支持dialogs方法……

热点排行