它提示 unknown directive "message" 我不知道怎样该(50分)

  • 主题发起人 主题发起人 paulhong
  • 开始时间 开始时间
P

paulhong

Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit4;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br>&nbsp; Dialogs, ExtCtrls, StdCtrls, Buttons,DateUtils, AppEvnts,ShellAPI, Menus;<br><br>&nbsp; &nbsp;const MY_MESSAGE = WM_USER + 1000;<br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; procedure FormCreate(Sender: TObject);<br>&nbsp; &nbsp; procedure FormDestroy(Sender: TObject);<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//procedure WMNID(var msg:TMessage); message MY_MESSAGE;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br>var<br>&nbsp; Form1:TForm1;<br>&nbsp; &nbsp; NotifyIcon:TNotifyIconData;<br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br>&nbsp; with NotifyIcon do<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; cbSize:=SizeOf(TNotifyIconData);<br>&nbsp; &nbsp; &nbsp; &nbsp; Wnd:=Handle; &nbsp; //指向当前窗体Form1的句柄<br>&nbsp; &nbsp; &nbsp; &nbsp; uID:=1;<br>&nbsp; &nbsp; &nbsp; &nbsp; uFlags:=NIF_ICON ;//or NIM_MESSAGE or NIM_TIP;<br>&nbsp; &nbsp; &nbsp; &nbsp; uCallBackMessage:=MY_MESSAGE;<br>&nbsp; &nbsp; &nbsp; &nbsp; hIcon:=Application.Icon.Handle;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp;Shell_NotifyIcon(NIM_ADD,@NotifyIcon);<br>&nbsp; &nbsp; &nbsp;//SetWindowLong(Application.Handle,GWL_EXSTYLE,WS_EX_TOOLWINDOW);//在任务栏上隐藏<br><br><br>end;<br>&nbsp;procedure WMNID(var msg:TMessage); message MY_MESSAGE;<br>&nbsp; begin<br>&nbsp;case msg.LParam of<br>&nbsp; &nbsp; &nbsp; WM_LBUTTONUp: Form1.Visible:=not Form1.Visible;<br>&nbsp; &nbsp; &nbsp; WM_RBUTTONUP: ShowMessage('您点击的是右键');<br>&nbsp; &nbsp;End;<br>End;<br><br>它提示 unknown directive "message" 我不知道怎样该<br><br><br><br>procedure TForm1.FormDestroy(Sender: TObject);<br>begin<br>&nbsp; Shell_NotifyIcon(NIM_DELETE,@NotifyIcon);<br><br>end;<br><br>end.
 
procedure WMNID(var msg:TMessage);[red]{ message MY_MESSAGE;} //这里去掉这个[/red]<br>&nbsp;begin<br>case msg.LParam of<br>&nbsp; &nbsp; &nbsp;WM_LBUTTONUp: Form1.Visible:=not Form1.Visible;<br>&nbsp; &nbsp; &nbsp;WM_RBUTTONUP: ShowMessage('您点击的是右键');<br>&nbsp; End;<br>End;<br>
 
接受答案了.
 

Similar threads

I
回复
0
查看
520
import
I
I
回复
0
查看
798
import
I
I
回复
0
查看
783
import
I
I
回复
0
查看
586
import
I
I
回复
0
查看
705
import
I
后退
顶部