在delphi7中怎么使窗口最小化后显示到任务栏上????? 在delphi7中怎么使窗口最小化后显示到任务栏上?????本人急切等待高人解答!!!!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 self.windowstate:=wsminimized后,窗口最小化到左下角,而没有最小化到任务栏上 http://search.csdn.net/expert/topic/53/5302/2002/3/22/592267.htm http://search.csdn.net/expert/topic/53/5301/2002/1/22/490640.htm procedure TForm1.Button1Click(Sender: TObject);begin application.Minimize; //這樣不可以嗎?end; 看看关于WM_SYSCOMMAND消息的文档,你会发现更多的东西。 托盘程序unit MainFrm;interface{ 记住在uses部分中包括 ShellAPI }uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ShellAPI, ExtCtrls;{ 自定义消息,当小图标捕捉到鼠标事件时 Windows 向回调函数发送此消息 }const MY_MESSAGE = WM_USER + 100;type TMainForm = class(TForm) Timer1: TTimer; procedure OnIconNotify(var Message: TMessage); message MY_MESSAGE; procedure FormCreate(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormPaint(Sender: TObject); procedure Timer1Timer(Sender: TObject); private { Private declarations } public { Public declarations } end;var MainForm: TMainForm;implementation{$R *.dfm}{ 当小图标捕捉到鼠标事件时进入此过程 }procedure TMainForm.OnIconNotify(var Message: TMessage);var Busy : Boolean;begin Busy := False; if not Busy then begin Busy := True; if Message.LParam=WM_LBUTTONDOWN then if Application.MessageBox('真的要退出日志定时清楚程序吗?', '提示', MB_YESNO)=IDYES then Close; Busy := False; end;end;{ 当主Form建立时通知windows加入小图标 }procedure TMainForm.FormCreate(Sender: TObject);var nid: TNotifyIconData;begin nid.cbSize := sizeof(nid); // nid 变量的字节数 nid.Wnd := Handle; // 主窗口句柄// nid.uID := -1; // 内部标识,可设为任意数 nid.hIcon := Application.Icon.Handle; // 要加入的图标句柄,可任意指定 nid.szTip := '定时清楚日志'; //提示字符串 nid.uCallbackMessage := MY_MESSAGE; //回调函数消息 nid.uFlags := NIF_ICON or NIF_TIP or NIF_MESSAGE; // 指明哪些字段有效 if not Shell_NotifyIcon(NIM_ADD,@nid) then begin ShowMessage('Failed!'); Application.Terminate; end; { 将程序的窗口样式设为TOOL窗口,可避免在任务条上出现 } SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);end;{ 程序被关闭时通知windows去掉小图标 }procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);var nid: TNotifyIconData;begin nid.cbSize := sizeof(nid); // nid变量的字节数// nid.uID := -1; // 内部标识,与加入小图标时的数一致 nid.Wnd := Handle; //主窗口句柄 Shell_NotifyIcon(NIM_DELETE, @nid); //去掉小图标end;{ 主窗口初始化完毕并显示时将激活 Paint 重画事件, 此时将主窗口隐藏 }procedure TMainForm.FormPaint(Sender: TObject);begin Hide;end;procedure TMainForm.Timer1Timer(Sender: TObject);var Hand : THandle;begin Hand := OpenEventLog('192.168.0.11','Application'); //打开本地日志 ClearEventLog(Hand,'c:\dd.evt'); //清除日志,指定备份文件 CloseEventLog(Hand); //关闭句柄 DeleteFile('c:\dd.evt'); //删除备份文件 Hand := OpenEventLog('192.168.0.11','System'); ClearEventLog(Hand,'c:\dd.evt'); CloseEventLog(Hand); DeleteFile('c:\dd.evt');end;end. application.Minimize; api也可以啊。 我用delphi显示photoshop输出的bmp总是通不过,为什么? gdiplus vista下出错 这段PB的函数怎么改成DELPHI语言? 对于高手,这是一个简单的问题。可是对我,却能让我失去学习的信心! 文件数据库问题 我的DELPHI是什么版本?!!请朋友们指点一下 今天我妹高考!散分200以祝愿我妹考出好成绩!!!希望大家和我一起祝福她!! 三层数据库服务器如何才能同时被多用户访问! 如何在程序中屏蔽掉系统热健:如 ctrl+alt+del, alt+tab等等 几个小问题,来拿分吧 如何下载文件??80高分求!! 添加数据报错的问题?在线等待!!!!!!!!!!
begin
application.Minimize; //這樣不可以嗎?
end;
unit MainFrm;interface{ 记住在uses部分中包括 ShellAPI }
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ShellAPI, ExtCtrls;{ 自定义消息,当小图标捕捉到鼠标事件时 Windows 向回调函数发送此消息 }
const MY_MESSAGE = WM_USER + 100;type
TMainForm = class(TForm)
Timer1: TTimer;
procedure OnIconNotify(var Message: TMessage);
message MY_MESSAGE; procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormPaint(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
MainForm: TMainForm;implementation{$R *.dfm}{ 当小图标捕捉到鼠标事件时进入此过程 }
procedure TMainForm.OnIconNotify(var Message: TMessage);
var
Busy : Boolean;
begin
Busy := False;
if not Busy then
begin
Busy := True;
if Message.LParam=WM_LBUTTONDOWN then
if Application.MessageBox('真的要退出日志定时清楚程序吗?', '提示', MB_YESNO)=IDYES then
Close;
Busy := False;
end;
end;{ 当主Form建立时通知windows加入小图标 }
procedure TMainForm.FormCreate(Sender: TObject);
var
nid: TNotifyIconData;
begin
nid.cbSize := sizeof(nid); // nid 变量的字节数
nid.Wnd := Handle; // 主窗口句柄
// nid.uID := -1; // 内部标识,可设为任意数
nid.hIcon := Application.Icon.Handle; // 要加入的图标句柄,可任意指定
nid.szTip := '定时清楚日志'; //提示字符串
nid.uCallbackMessage := MY_MESSAGE; //回调函数消息 nid.uFlags := NIF_ICON or NIF_TIP or NIF_MESSAGE; // 指明哪些字段有效
if not Shell_NotifyIcon(NIM_ADD,@nid) then
begin
ShowMessage('Failed!');
Application.Terminate;
end;
{ 将程序的窗口样式设为TOOL窗口,可避免在任务条上出现 }
SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
end;{ 程序被关闭时通知windows去掉小图标 }
procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
var
nid: TNotifyIconData;
begin
nid.cbSize := sizeof(nid); // nid变量的字节数
// nid.uID := -1; // 内部标识,与加入小图标时的数一致
nid.Wnd := Handle; //主窗口句柄
Shell_NotifyIcon(NIM_DELETE, @nid); //去掉小图标
end;{ 主窗口初始化完毕并显示时将激活 Paint 重画事件, 此时将主窗口隐藏 }
procedure TMainForm.FormPaint(Sender: TObject);
begin
Hide;
end;procedure TMainForm.Timer1Timer(Sender: TObject);
var
Hand : THandle;
begin
Hand := OpenEventLog('192.168.0.11','Application'); //打开本地日志
ClearEventLog(Hand,'c:\dd.evt'); //清除日志,指定备份文件
CloseEventLog(Hand); //关闭句柄
DeleteFile('c:\dd.evt'); //删除备份文件
Hand := OpenEventLog('192.168.0.11','System');
ClearEventLog(Hand,'c:\dd.evt');
CloseEventLog(Hand);
DeleteFile('c:\dd.evt');
end;end.
api也可以啊。