That worked perfectly...thanx rob!  I had used GetKeyState() once
before but forgot all about it...still this is easier because
GetAsyncKeyState() allows you to use the virtual Key codes, and I know most
of them by heart.

from Robert Meek dba Tangentals Design


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Rob Kennedy
Sent: Sunday, December 25, 2005 2:22 AM
To: Borland's Delphi Discussion List
Subject: Re: D2006 and keydown situations

Robert Meek wrote:
> In addition to this, I want to be able to alter this default
> double-click trayicon command so that a different command is run IF and
only
> IF either shift key is being held down at the same time it is
> double-clicked.  Obviously I don't want or expect to be able to run the
> secondary branch command of the double-click at the same time the Ctrl +
> somekey is clicked, but I DO want it to branch if and when I use the mouse
> to actually double-click the trayicon.

When the OS sends its callback message to your form notifying you of a 
double-click on the notification icon, check whether the Shift key is down.

GetAsyncKeyState(vk_Shift);

> So I'm looking for the "best" way to handle this.  I tried setting
> the mainform's KeyPreview to true and having the OnKeyDown event of the
> shift Key set a Boolean var so that if the trayicon were double-clicked
and
> this var was set it would branch the command as wanted, but this doesn't
> work.  I'm not sure if this is because the trayicon has it's own handle
and
> so the Keypreview of the mainform isn't getting used or what.  Any ideas
> would be appreaciated!

Your form is hidden. It does not have focus. Therefore, it cannot 
receive keyboard messages.

Your notification icon does not have a window handle. (It has an icon 
handle, of course, but that's a separate issue.) The icon is displayed 
wherever the shell decides to display it. For now, that's usually in a 
child window of the taskbar. That window belongs to the shell. When you 
operate the mouse over that window, the shell will figure out which icon 
is underneath the cursor, and then look up the window handle associated 
with that icon, as set when you called Shell_NotifyIcon. The shell then 
sends a message to that window. The message ID was also set with 
Shell_NotifyIcon. The wParam parameter holds the icon ID, and the lParam 
parameter holds the ID of the mouse message that the shell is currently 
responding to, typically wm_MouseMove or wm_ContextMenu.

-- 
Rob
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to