Delphi如何使程序不在系统任务条上出现
4148 点击·0 回帖
![]() | ![]() | |
![]() | 相关下载:delphiV7.0 程序的初始化过程,即在窗体的FormCreate()事件中添加代码。在程序设计阶段,用鼠标的左键双击窗体上的空白处,在屏幕上就会弹出一个代码窗口,把光标移动到FormCreate()过程的处理代码中,并且添加如下代码: procedure TForm1.FormCreate(Sender: TObject); begin SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW); end; 在程序运行的初期,首先激活窗体FormCreate()过程中的代码,通过SetWindowLong (Application.Handle,GWL_EXSTYLE,WS_EX_TOOLWINDOW)这条语句就可以实现从系统任务条上隐藏本程序的功能。 程序代码如下: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW); end; end. 保存文件,然后按F9键运行程序。 | |
![]() | ![]() |