如何在状态栏中加入图标(或图片),还有动态的时间
2006-02-04 13:25:39 来源:WEB开发网核心提示:function Shell_NotifyIcon(dwMessage:DWord;lpData:PNotifyIconData):BOOL;stdcall;在shellapi单元中,dwMessage:NIM_ADDNIM_MODIFYNIM_DELETEPNotifyIconData=^TNotifyIconDat
function Shell_NotifyIcon(dwMessage:DWord;lpData:PNotifyIconData):BOOL;stdcall;
在shellapi单元中。
dwMessage:NIM_ADD
NIM_MODIFY
NIM_DELETE
PNotifyIconData=^TNotifyIconDataA
TNotifyIconDataA=record
cbSize:DWORD;
Wnd:HWND;
uID:UINT;
uFlags:UINT;
uCallbackMessage:UINT;
hIcon:HICON;
szTip:array[0..63] of AnsiChar;
end;
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
...
const
MyIconID=1;
MyIconEvent=WM_USER+1;
...
PRivate
...
MyIcon:TIcon;
...
//Install
var
IconData:TNotifyIcon;
...
MyIcon:=TIcon.Create;
MyIcon.LoadFromFile('icon1.ico');
with IconData do
begin
cbSize:=SizeOf(IconData); //
Wnd:=Form1.Handle; //
uID:=MyIconID; //
uFlags:=NIF_ICON;
uCallBackMessage:=MyIconEvent;
hIcon:=Handle; //Change
szTip:='My Test Icon';
Shell_NotifyIcon(NIM_ADD,@IconData);
...
//做了标记的是改或删时要设的。
//precedure IconOnClick(msg:TMessage);message MyIconEvent;
if(msg.lParam=WM_RBUTTONDOWN) then
GetCursorPos(p); //p:TPoint;
PopupMenu1.Popup(p.x,p.y);
在shellapi单元中。
dwMessage:NIM_ADD
NIM_MODIFY
NIM_DELETE
PNotifyIconData=^TNotifyIconDataA
TNotifyIconDataA=record
cbSize:DWORD;
Wnd:HWND;
uID:UINT;
uFlags:UINT;
uCallbackMessage:UINT;
hIcon:HICON;
szTip:array[0..63] of AnsiChar;
end;
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
...
const
MyIconID=1;
MyIconEvent=WM_USER+1;
...
PRivate
...
MyIcon:TIcon;
...
//Install
var
IconData:TNotifyIcon;
...
MyIcon:=TIcon.Create;
MyIcon.LoadFromFile('icon1.ico');
with IconData do
begin
cbSize:=SizeOf(IconData); //
Wnd:=Form1.Handle; //
uID:=MyIconID; //
uFlags:=NIF_ICON;
uCallBackMessage:=MyIconEvent;
hIcon:=Handle; //Change
szTip:='My Test Icon';
Shell_NotifyIcon(NIM_ADD,@IconData);
...
//做了标记的是改或删时要设的。
//precedure IconOnClick(msg:TMessage);message MyIconEvent;
if(msg.lParam=WM_RBUTTONDOWN) then
GetCursorPos(p); //p:TPoint;
PopupMenu1.Popup(p.x,p.y);
赞助商链接