⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ddeform.pas

📁 在delphi中实现windows核心编程.原书光盘代码核心编程.原书光盘代码
💻 PAS
字号:
unit Ddeform;

interface

uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, StdCtrls, DdeMan,
  Dialogs, ComCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    GroupName: TEdit;
    CreateButton: TButton;
    Button2: TButton;
    DDEClient: TDdeClientConv;
    Label3: TLabel;
    ItemName: TEdit;
    Button1: TButton;
    CmdLine: TEdit;
    WorkDir: TEdit;
    Label4: TLabel;
    Label5: TLabel;
    Button3: TButton;
    OpenDialog: TOpenDialog;
    Label2: TLabel;
    procedure Button2Click(Sender: TObject);
    procedure CreateButtonClick(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

uses  SysUtils;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Close;
end;

procedure TForm1.CreateButtonClick(Sender: TObject);
var
  Name: string;
  Macro: string;
  Cmd: array[0..255] of Char;
begin
  if GroupName.Text = '' then
    MessageDlg('组名不能为空.', mtError, [mbOK], 0)
  else
  begin
    Name := GroupName.Text;
    Macro := Format('[CreateGroup(%s)]', [Name]) + #13#10;
    StrPCopy (Cmd, Macro);
    DDEClient.OpenLink;
    if not DDEClient.ExecuteMacro(Cmd, False) then
      MessageDlg('不能创建组.', mtInformation, [mbOK], 0);
    DDEClient.CloseLink;
    GroupName.SelectAll;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  item,command,dir: string;
  Macro: string;
  Cmd: array[0..255] of Char;
begin
 if GroupName.Text = '' then
    MessageDlg('组名不能为空.', mtError, [mbOK], 0)
  else
  begin
    item := ItemName.text;
    command := CmdLine.text;
    dir := WorkDir.Text;
    Macro := Format('[AddItem(%s,%s)]', [command,item,dir]) + #13#10;
    StrPCopy (Cmd, Macro);
    DDEClient.OpenLink;
    if not DDEClient.ExecuteMacro(Cmd, False) then
      MessageDlg('不能创建项.', mtInformation, [mbOK], 0);
    DDEClient.CloseLink;
    GroupName.SelectAll;
  end;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  if OpenDialog.execute then
    cmdLine.text:=OpenDialog.fileName;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -