DdeClientConv学习第一例的错误(50分)

  • 主题发起人 主题发起人 wuzhonglinquan
  • 开始时间 开始时间
W

wuzhonglinquan

Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DdeMan;
type
TForm1 = class(TForm)
DdeClientConv1: TDdeClientConv;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
procedure RunMacro(Macro:PChar);
public
{ Public declarations }
end;

var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
RunMacro('[FileNew]');
end;

procedure TForm1.RunMacro(Macro: PChar);
var
pMacro:array[0..80] of char;
begin
DdeClientConv1.SetLink('winWord.exe','system');
DdeClientConv1.OpenLink;
strCopy(pMacro,Macro);
//把Macro复制到pMacro,返回Pchar字符串
if Not DdeClientConv1.ExecuteMacro(pMacro,false) then
ShowMessage('Unable to Execute Macro');
DdeClientConv1.CloseLink;
end;

end.

所有代码都是看书的,编译通过了,但是就是调不出来word程序,为什么?
 
dde 过时了,还是建议用 com 操作 word 吧
 
后退
顶部