unit memo0001;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ShellAPI;
type
TForm1 = class(TForm)
PopupMenu1: TPopupMenu;
protected
procedure WndProc(var Msg: TMessage); override;
end;
const
TASKTRAY_MSG = WM_USER + 100;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm.WndProc(var Msg: TMessage);
var
pt: TPoint;
begin
if Msg.Msg = TASKTRAY_MSG then begin
case Msg.LParam of
WM_RBUTTONDOWN: begin
GetCursorPos(pt);
SetForegroundWindow(Handle);
PopupMenu1.Popup(pt.X, pt.Y);
end;
end;
end;
end;
|