大哥们,谁教教我如何写进系统的开始项目啊?
大哥们,谁教教我如何写进系统的开始项目啊? 问题点数:20、回复次数:2Top
1 楼cpplus(技术就是要坚持)回复于 2002-03-05 21:17:42 得分 20
一个写到“启动”里的例子:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DdeMan;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
Edit2: TEdit;
OpenDialog1: TOpenDialog;
DdeClientConv1: TDdeClientConv;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject);
begin
if OpenDialog1.Execute then
Edit1.Text := OpenDialog1.FileName;//获取可执行文件的文件名
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Macro:string;
Cmd : array[0..255] of Char;
begin
if Edit1.Text='' then//判断文件名是否为空
begin
MessageBox(Handle,'程序名称不可以为空。','错误',MB_OK+MB_ICONERROR);
Exit;
end;
//打开"启动"程序项
Macro:=Format('[CreateGroup(%s)]',['启动']) + #13#10;
StrPCopy(Cmd,Macro);
DdeClientConv1.OpenLink;
if DdeClientConv1.ExecuteMacro(Cmd,False) = False then
begin
MessageBox(0,'打开启动程序项失败。','错误',MB_OK+MB_ICONERROR);
Exit;
end;
Macro:=Format('[AddItem("%s",%s)]',[Edit1.Text,Edit2.Text])+#13#10;
StrPCopy(Cmd,Macro);
DdeClientConv1.OpenLink;
//创建应用程序的快捷方式
if DdeClientConv1.ExecuteMacro(Cmd,False) = False then
begin
MessageBox(0,'创建程序项失败。','错误',MB_OK+MB_ICONERROR);
Exit;
end;
end;
end.
Top
2 楼qiqi97(迷茫)回复于 2002-03-05 21:23:30 得分 0
谢谢,我试试看啊~!~!Top




