Buttons in Win95 task bar
Can anyone tell me of a way or a component or whatever else that will allow delphi 2 or 3 to place a button on the task bar much like what PowerDesk 2.0 Toolbar does.
Here are the code snipits to do just that!
// This needs to be in your public declarations @ the top of the pas file
procedure TForm1.IconCallBackMessage( var Mess : TMessage ); message WM_USER
+ 100;
procedure TForm1.FormCreate(Sender: TObject);
var
nid : TNotifyIconData;
begin
with nid do
begin
cbSize := SizeOf( TNotifyIconData );
Wnd := Form1.Handle;
uID := 1;
uFlags := NIF_ICON or NIF_MESSAGE or NIF_TIP;
uCallbackMessage := WM_USER + 100;
hIcon := Application.Icon.Handle;
szTip := 'This is the hint!';
end;
Shell_NotifyIcon( NIM_ADD, @nid );
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
nid : TNotifyIconData;
begin
with nid do
begin
cbSize := SizeOf( TNotifyIconData );
Wnd := Form1.Handle;
uID := 1;
uFlags := NIF_ICON or NIF_MESSAGE or NIF_TIP;
uCallbackMessage := WM_USER + 100;
hIcon := Application.Icon.Handle;
szTip := 'This is the hint!';
// All the above is probably not needed.
end;
Shell_NotifyIcon( NIM_DELETE, @nid );
end;
procedure TForm1.IconCallBackMessage( var Mess : TMessage );
var
sEventLog : String;
begin
case Mess.lParam of
// Do whatever you wish here. For example popup up a menu on a right click.
WM_LBUTTONDBLCLK : sEventLog := 'Left Double Click';
WM_LBUTTONDOWN : sEventLog := 'Left Down';
WM_LBUTTONUP : sEventLog := 'Left Up';
WM_MBUTTONDBLCLK : sEventLog := 'M Dbl';
WM_MBUTTONDOWN : sEventLog := 'M D';
WM_MBUTTONUP : sEventLog := 'M U';
WM_MOUSEMOVE : sEventLog := 'movement';
WM_MOUSEWHEEL : sEventLog := 'Wheel';
WM_RBUTTONDBLCLK : sEventLog := 'r dbl';
WM_RBUTTONDOWN : sEventLog := 'r down';
WM_RBUTTONUP : sEventLog := 'r up';
end;
end;
|