lifeson
asked on
icon communicating with application
How do i make an icon at the taskbar communicate with my applicantion. For example: when i right click on the icon i want to make a popup menu appears.
ASKER
This answer appears in other qustion already. i made this but when i click at the icon, nothing heappens. Please, i want more dettails about it.
make sure to write
TForm1= ....
PROCEDURE WndProc(var MyMessage: TMessage); OVERRIDE; //IMPORTANT... if you don't override, nothing will happen...
Did that solve the problem?
TForm1= ....
PROCEDURE WndProc(var MyMessage: TMessage); OVERRIDE; //IMPORTANT... if you don't override, nothing will happen...
Did that solve the problem?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
As Holger says, Did you write override?
Place 3 buttons for Add, Delete and modify the Icon in the TaskBar.
Place a Popup menu with some items and write the following code:
uses ShellAPI;
.
var IconData :TNotifyIconData;
..
procedure TForm1.bbAddClick(Sender: TObject);
begin
with IconData DO
begin
cbSize := SizeOf(IconData);
uFlags := NIF_ICON OR NIF_TIP OR NIF_MESSAGE;
uID := 0;
Wnd := Handle;
szTip := 'This is my Application'+#0;
hIcon := Application.Icon.Handle;
uCallBackMessage := WM_USER+$10;
end;
if Shell_NotifyIcon(NIM_ADD,@
end;
procedure TForm1.bbModifyClick(Sende
begin
with IconData do
begin
szTip := 'app is modified'+#0;
hIcon := LoadIcon(0,IDI_ASTERISK);
end;
if Shell_NotifyIcon(NIM_MODIF
end;
procedure TForm1.bbDeleteClick(Sende
begin
if Shell_NotifyIcon(NIM_DELET
end;
procedure TForm1.WndProc(var MyMessage: TMessage);
var CursorPos: TPoint;
begin
IF MyMessage.Msg = WM_USER+$10 THEN
CASE MyMessage.LParam OF
WM_RBUTTONUP :
BEGIN
GetCursorPos(CursorPos);
PopupMenu1.Popup(CursorPos
END;
WM_LBUTTONDBLCLK :
ShowMessage('This is my application');
END;
INHERITED WndProc(MyMessage);
end;