各位大侠,请教如何实现将程序最小化到系统托盘中? 请教如何实现将程序最小化到系统托盘中?程序最小化,只在系统托盘中停留。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 楼主,上盒子上搜搜trayicon这个控件,实现了托盘的多种效果,很不错. unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Menus, ImgList, StdCtrls, ShellAPI, ExtCtrls;const mymsg = wm_user + 1; iid = 100;type TForm1 = class(TForm) Button1: TButton; PopupMenu1: TPopupMenu; a11: TMenuItem; b11: TMenuItem; c11: TMenuItem; Image1: TImage; procedure Button1Click(Sender: TObject); procedure c11Click(Sender: TObject); procedure a11Click(Sender: TObject); private { Private declarations } procedure mymessage(var message:tmessage); message mymsg; public { Public declarations } end;var Form1: TForm1; ntid: TnotifyIconDataA;implementation{$R *.dfm}//隐藏窗口,在托盘上显示图标procedure TForm1.Button1Click(Sender: TObject);begin ntid.cbsize := sizeof(TnotifyIconDataA); ntid.Wnd := Handle; ntid.uID := iid; ntid.uFlags := NIF_ICON + NIF_TIP + NIF_MESSAGE; ntid.uCallbackMessage := mymsg; ntid.hIcon := image1.Picture.Icon.Handle; ntid.szTip := 'asdf'; shell_notifyicona(NIM_ADD,@ntid); self.Visible := false;end;//处理鼠标右键,弹出菜单procedure TForm1.mymessage(var message:tmessage );var mypt:Tpoint;begin Inherited; if message.LParam = WM_RBUTTONUP then begin getCursorPos(mypt); PopupMenu1.Popup(mypt.X, mypt.Y); end; message.rResult := 0;end;procedure TForm1.c11Click(Sender: TObject);begin close;end;//还原窗口,托盘图标消失procedure TForm1.a11Click(Sender: TObject);begin ntid.cbSize := sizeof(TnotifyIconDataA); ntid.Wnd := Handle; ntid.uID := iid; ntid.uFlags := NIF_ICON + NIF_TIP + NIF_MESSAGE; ntid.uCallbackMessage := mymsg; ntid.hIcon := image1.Picture.Icon.Handle; ntid.szTip := 'asdf'; shell_notifyicona(NIM_DELETE,@ntid); self.Visible := true;end;end. delphi 中如何获取分页的网页的全部内容? 推荐一个小软件:拼拼看 1.0版(我费了一个多星期整出来的) Delphi中Memo组件的光标定位(用的是Delphi7.0)--希望大家能帮我看看 (up加分)sqlserver备份与恢复(从服务器备份到本地,从本地恢复到服务器) 我的程序中用到了indy控件,是在主界面中用TIdAntiFreeze还是在线程中用? 一个简单的问题,请高手解答!!! 在线等 自做控件一套,要DEMO者,请留E-MAIL 文本的任何字符是不是都一iis编码的? 请教BELPHI高手 怎样编写一个Delphi获取modem来电号码的程序? 做过三层系统的请进
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, ImgList, StdCtrls, ShellAPI, ExtCtrls;const
mymsg = wm_user + 1;
iid = 100;type
TForm1 = class(TForm)
Button1: TButton;
PopupMenu1: TPopupMenu;
a11: TMenuItem;
b11: TMenuItem;
c11: TMenuItem;
Image1: TImage;
procedure Button1Click(Sender: TObject);
procedure c11Click(Sender: TObject);
procedure a11Click(Sender: TObject);
private
{ Private declarations }
procedure mymessage(var message:tmessage);
message mymsg;
public
{ Public declarations }
end;var
Form1: TForm1;
ntid: TnotifyIconDataA;implementation{$R *.dfm}//隐藏窗口,在托盘上显示图标
procedure TForm1.Button1Click(Sender: TObject);
begin
ntid.cbsize := sizeof(TnotifyIconDataA);
ntid.Wnd := Handle;
ntid.uID := iid;
ntid.uFlags := NIF_ICON + NIF_TIP + NIF_MESSAGE;
ntid.uCallbackMessage := mymsg;
ntid.hIcon := image1.Picture.Icon.Handle;
ntid.szTip := 'asdf';
shell_notifyicona(NIM_ADD,@ntid); self.Visible := false;
end;//处理鼠标右键,弹出菜单
procedure TForm1.mymessage(var message:tmessage );
var
mypt:Tpoint;
begin
Inherited;
if message.LParam = WM_RBUTTONUP then
begin
getCursorPos(mypt);
PopupMenu1.Popup(mypt.X, mypt.Y);
end;
message.rResult := 0;
end;procedure TForm1.c11Click(Sender: TObject);
begin
close;
end;//还原窗口,托盘图标消失
procedure TForm1.a11Click(Sender: TObject);
begin
ntid.cbSize := sizeof(TnotifyIconDataA);
ntid.Wnd := Handle;
ntid.uID := iid;
ntid.uFlags := NIF_ICON + NIF_TIP + NIF_MESSAGE;
ntid.uCallbackMessage := mymsg;
ntid.hIcon := image1.Picture.Icon.Handle;
ntid.szTip := 'asdf';
shell_notifyicona(NIM_DELETE,@ntid);
self.Visible := true;
end;end.