Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 16th, 2006, 10:44 AM   #1
JoseCardoso
Newbie
 
Join Date: May 2006
Posts: 4
Rep Power: 0 JoseCardoso is on a distinguished road
Shell_NotifyIcon

Hi, I’m trying to put my program as tray icon in a Taskbar of Windows, the Icon appears but when I try to use the mouse, he simply doesn’t work, this is code I’m using:
procedure TForm1.Button1Click(Sender: TObject);

var
  LTrayI : PNotifyIconData;

begin

  LTrayI.cbSize := SizeOf(LTrayI);
  LTrayI.Wnd := Application.Handle;
  LTrayI.uID := 1;
  LTrayI.uFlags := NIF_ICON or NIF_TIP or NIF_MESSAGE;
  LTrayI.uCallbackMessage := WM_LBUTTONDOWN;
  LTrayI.hIcon := Self.Icon.Handle;
  LTrayI.szTip := 'Tooltip test' + chr(0);

  Shell_NotifyIcon(NIM_ADD, LTrayI);

end;
JoseCardoso is offline   Reply With Quote
Old Dec 9th, 2007, 8:39 AM   #2
myworkstation
Newbie
 
Join Date: Dec 2007
Posts: 8
Rep Power: 0 myworkstation is on a distinguished road
Re: Shell_NotifyIcon

you correct.i just see you add icon action now.
example:
the uCallBackMessage is pointer yourself defined message.no standard message.
const WM_TRAYNOTIFY=WM_USER+100;

LTrayI.uCallbackMessage:=WM_TRAYNOTIFY;

after you can capture this message.declare this:
procedure NotifyIconClick(var Msg:TMessage);message WM_TRAYNOTIFY;

implement

procedure TForm1.NotifyIconClick(var msg: tmessage);
var IconPoint:TPoint;
begin
case Msg.LParam of

WM_LBUTTONUP:
begin
end;

WM_RBUTTONUP:
begin
GetCursorPos(IconPoint);
PopupMenu.Popup(IconPoint.X,IconPoint.Y);
end;

end;
end;
myworkstation is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:16 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC