我定义了一个过程procedure WMNID(var msg:TMessage); message WM_NID;
编译的时候说,Unknown directive: 'message',请问这个是什么问题?
WM_NID 我已经定义了 const WM_NID=WM_USER+1000;
编译的时候说,Unknown directive: 'message',请问这个是什么问题?
WM_NID 我已经定义了 const WM_NID=WM_USER+1000;
解决方案 »
- 送分100分:求几个VC6中的数据类型与DELPHI6相对应的数据类型
- 求“超长整数求余”的算法实现。100分。
- filter 连接的问题
- 今天面试遇到一个难题,请大家赐教,多谢了dbgrid分类显示的问题
- Delphi中如何使用VC开发出来的DCOM?
- 有没有这样的方法关于网络的方案:在我的网站上有个access的数据库,我本机器从外界接受一条数据就发到网站上这个access的数据
- 如何让TImage的Canvas在绘图时不产生闪烁感?
- GotoBookmark(pointer(FzhDBGrid1.SelectedRows.Items[j]))问题
- 一个SpinEdit的问题!
- C中的myInteger=*myPointer,在delphi下怎么写?
- 如何隐藏程序,就是任务栏上没有程序,系统右下角的托盘上有显示程序图标
- ASP中调用DELPHI封装的richedit组件
const WM_NID=WM_USER+1000;
放在
procedure WMNID(var msg:TMessage); message WM_NID;
的前面
const WM_NID=WM_USER+1000;
放在
procedure WMNID(var msg:TMessage); message WM_NID;
的前面
可是报错
还是报错。
名字换了也一样
郁闷啊
里写东西啊
我把我的源码贴出来。
大家帮忙看看吧unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, shellapi;
const WM_NID=WM_USER+1000;type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
procedure WMNID(var msg:TMessage); message WM_NID; //这里message报错
var
Form1: TForm1;
Extendedstyle:integer;
NotifyIcon:TNotifyIconData;
implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
Extendedstyle := GetWindowLong (Application.Handle, GWL_EXstyle);
SetWindowLong(Application.Handle, GWL_EXstyle, Extendedstyle OR WS_EX_TOOLWINDOW
AND NOT WS_EX_APPWINDOW); //用于隐藏任务栏上的程序 With NotifyIcon do
begin
cbSize:=SizeOf(TNotifyIconData);
Wnd:=Handle;
uID:=1;
uFlags:=NIM_ICON or NIM_MESSAGE or NIM_TIP; //这里的三个参数也报错,说是Undeclared identifier
uCallBackMessage:=WM_NID;
hIcon:=Application.Icon.Handle;
szTip:='我是老大';
end;
Shell_NotifyIcon(NIM_ADD,@NotifyIcon);
end;procedure WMNID(var msg:TMessage); message WM_NID; //这里的message也有问题
begin
case msg.LParam of
WM_LBUTTONUp: Form1.Visible:=not Form1.Visible;
WM_RBUTTONUP: ShowMessage('right');
End;
End;
procedure TForm1.FormDestroy(Sender: TObject);
begin
Shell_NotifyIcon(NIM_DELETE,@NotifyIcon);
end;end.
{ Private declarations }
NotifyIcon: TNotifyIconData;
procedure IconOnClick(var Msg: TMessage); message WM_NID;
//把它放在private声明中去,再试试看
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, shellapi;
const WM_NID=WM_USER+1000;type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
procedure WMNID(var msg:TMessage); message WM_NID; //这里message报错
{ Public declarations }
end;
var
Form1: TForm1;
Extendedstyle:integer;
NotifyIcon:TNotifyIconData;
implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
Extendedstyle := GetWindowLong (Application.Handle, GWL_EXstyle);
SetWindowLong(Application.Handle, GWL_EXstyle, Extendedstyle OR WS_EX_TOOLWINDOW
AND NOT WS_EX_APPWINDOW); //用于隐藏任务栏上的程序 With NotifyIcon do
begin
cbSize:=SizeOf(TNotifyIconData);
Wnd:=Handle;
uID:=1;
uFlags:=NIM_ICON or NIM_MESSAGE or NIM_TIP; //这里的三个参数也报错,说是Undeclared identifier
uCallBackMessage:=WM_NID;
hIcon:=Application.Icon.Handle;
szTip:='我是老大';
end;
Shell_NotifyIcon(NIM_ADD,@NotifyIcon);
end;procedure TForm1.WMNID(var msg:TMessage); message WM_NID; //这里的message也有问题
begin
case msg.LParam of
WM_LBUTTONUp: Form1.Visible:=not Form1.Visible;
WM_RBUTTONUP: ShowMessage('right');
End;
End;
procedure TForm1.FormDestroy(Sender: TObject);
begin
Shell_NotifyIcon(NIM_DELETE,@NotifyIcon);
end;end.
procedure TForm1.WMNID(var msg:TMessage); message WM_NID; //这里的message也有问
你现在是实现函数,后面不用跟消息了。
改成
procedure TForm1.WMNID(var msg:TMessage);至于其他的。 uFlags:=NIM_ICON or NIM_MESSAGE or NIM_TIP; //这里的三个参数也报错,说是Undeclared identifier去看看他们是哪个单元定义的常量,引用那个单元了。。我忘记了!
我把procedure WMNID(var msg:TMessage); message WM_NID; 放到 public 里
WMNID过程中的message WM_NID;去掉就可以通过了。
至于那个uFlags:=NIM_ICON or NIM_MESSAGE or NIM_TIP;我很是纳闷。
代码重新复制粘贴一遍就没有错了。
真是奇怪。