NotifyIcon:TNotifyIconData;
在给 NotifyIcon 赋值的时候 用了下面这些代码
with NotifyIcon do
begin
cbSize:=SizeOf(TNotifyIconData);
Wnd:=Handle;
uID:=1;
uFlags:=NIM_ICON or NIM_MESSAGE or NIM_TIP;
uCallBackMessage:=WM_NID;
hIcon:=Application.Icon.Handle;
szTip:='我是老大';
可是编译的时候说Undeclared identifier:'NIM_ICON'
Undeclared identifier:'NIM_MESSAGE'
这个是怎么回事啊
在给 NotifyIcon 赋值的时候 用了下面这些代码
with NotifyIcon do
begin
cbSize:=SizeOf(TNotifyIconData);
Wnd:=Handle;
uID:=1;
uFlags:=NIM_ICON or NIM_MESSAGE or NIM_TIP;
uCallBackMessage:=WM_NID;
hIcon:=Application.Icon.Handle;
szTip:='我是老大';
可是编译的时候说Undeclared identifier:'NIM_ICON'
Undeclared identifier:'NIM_MESSAGE'
这个是怎么回事啊
解决方案 »
- 查找文件名中怎样区分大小写?
- 生成器生成的 EXE文件如何能让他压缩和加壳后生成出来 。防止看到密码
- 想学一下DELPHI下的CORBA方式编程,但不知道从何学起,大家有没有简单的例子让我入门
- 200分:Delphi中使用OCX,如何添加 Runtime License 信息?
- 谁能提供几本电子图书的下载地址dephi的
- 如何发送手机短信啊,急急急,急死了
- 好东西大家分享:用DSPACK2.2中关DirectShow播放VCD时左右声道切换问题的方法,欢迎大家发表看法
- DELPHI 中位操作(bitwise)的问题
- 在显示的时候怎么样将DATETIMEPICKER控件中时间的秒去掉?就是把后边两个零去掉.
- IP合法性检验
- 开仓放粮了—有三条裤衩可以换洗了:)
- 关于message消息
'NIM_MESSAGE'两个是其它单元的变量吧用uses语句引用一下定义她的单元吧
const NIM_MESSAGE=WM_USER+10;
是 NIF_MESSAGE or NIF_ICON or NIF_TIP 吧
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Menus,shellapi; const
WM_TrayMessage=WM_User+100; //这句是你要加的
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
N11: TMenuItem;
N21: TMenuItem;
N22: TMenuItem;
N23: TMenuItem;
N24: TMenuItem;
N31: TMenuItem;
N32: TMenuItem;
PopupMenu1: TPopupMenu;
er1: TMenuItem;
rer1: TMenuItem;
rer2: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure N21Click(Sender: TObject);
procedure rer1Click(Sender: TObject);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
protected
procedure AppMinimized(Sender: TObject);
procedure WMTrayMessage(var msg:TMessage);message WM_TrayMessage;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
NID:TNotifyIconData;
implementation
{$R *.DFM}
{ TForm1 }
procedure TForm1.AppMinimized(Sender: TObject);
begin
NID.cbSize:=SizeOf(TNotifyIconData);
NID.hIcon:=Application.Icon.Handle;
NID.szTip:= '工程一 ';
NID.uCallbackMessage:=WM_TrayMessage;
NID.uFlags:=NIF_ICON or NIF_MESSAGE or NIF_TIP; //这句是你要改的
NID.uID:=0;
NID.Wnd:=Handle;
Shell_NotifyIcon(NIM_ADD,@NID);
ShowWindow(Application.Handle,SW_Hide);
end;
procedure TForm1.WMTrayMessage(var msg: TMessage);
var
p:TPoint;
begin
if msg.LParam=WM_LButtonDown then
begin
ShowWindow(Application.Handle,SW_Show);
Application.Restore;
end
else if msg.LParam=WM_RButtonDown then
begin
GetCursorPos(p);
PopupMenu1.Popup(p.x,p.y);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
//var Owner : HWnd;
begin
//Owner:=GetWindow(Handle,GW_OWNER);
// ShowWindow(Owner,SW_HIDE);
Application.OnMinimize:=AppMinimized;
AppMinimized(nil);
end;
//指定在该结构中uCallbackMessage、hIcon和szTip参数都有效