Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Delphi (http://www.programmingforums.org/forum41.html)
-   -   Shell_NotifyIcon (http://www.programmingforums.org/showthread.php?t=11603)

JoseCardoso Oct 16th, 2006 10:44 AM

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;


myworkstation Dec 9th, 2007 8:39 AM

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;


All times are GMT -5. The time now is 8:11 PM.

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