状态栏
use shellApi ,message
const WM_MynotifyMessage = WM_user+1
private
procedure OnsysCommand(var Msg:Tmessage);Message WM_SysCommand;
procedure OnMyNotifyMessage(var Msg:Tmessage);Message WM_MyNotifyMessage;
procedure TForm.OnSysCommand(var Msg:TMessage);
begin
if Msg.WParam <>SC_close then
begin
defWindowProc(Handle,WM_SysCommand,Msg.Wparam,Msg.WLParam)
end
else
begin
Hide;
end;
end;
procedure TFrom.OnMyNotifyMessage(var Msg:TMessage)
var
P:Tpoint;
begin
Case msg.Lparam of
WM_LButtonUP : Show;
WM_RButtonUP:begin
GetCurrentPos(P);
PopupMenu(p.x,p.y);
end;
end;
end;
procedure TForm.Create(Sender:Tobject);
var
NID:NoTifyiConData;
begin
NID.CBSize :=sizeof(NID);
NID.wnd :=self.handle;
NID.UID :=0;
NID.uFlags :=NIf_ICOn or NIf_message or NIf_TIP;
NID.ucallbackmessage := WM_MynotifyMessage;
NID.nIcon :=Icon.handle;
strCopy(NID.szTip,'FormTest');
shell_notifyIcon(NIM_Add,@NID);
end;
浙公网安备 33010602011771号