注册 登录
编程论坛 Delphi论坛

关闭时打开网页

my3615115 发布于 2007-04-19 13:48, 863 次点击

以前看到教主等人编写的程序,在关闭时都会弹出一张网页,现在初学Delphi,也明白了其中的奥秘,现在演示给大家拉:

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,ShellApi, Menus;

type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
MainMenu1: TMainMenu;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ShellExecute(0,'open','iexplore.exe','http://www.msinfo.cn','',SW_SHOWNORMAL);
end;

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

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

end.

[此贴子已经被作者于2007-4-19 13:53:13编辑过]

0 回复
1