Easy way to hide taskbar icon on minimize?

How do I hide the taskbar icon on minimize?

Thanks
ripcordAsked:
Who is Participating?
 
viktornetConnect With a Mentor Commented:
Here is what you do....
  private
    procedure MyMin(Sender : TObject);
    procedure MyRes(Sender : TObject);

procedure TForm1.MyMin(Sender : TObject);
begin
    ShowWindow(Application.Handle, SW_HIDE);
end;
procedure TFOrm1.MyRes(Sender : TObject);
begin
    ShowWindow(Application.Handle, SW_RESTORE);
end;

Regards,
Viktor Ivanov
0
 
viktornetCommented:
What do you call a taskbar icon??

//Vik
0
 
MadshiCommented:
ripcord,

if you mean the taskbar button, just call
"ShowWindow(form1.handle,SW_HIDE)"

Regards, Madshi.
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
JimBob091197Commented:
Or ShowWindow(Application.Handle, SW_HIDE); to remove the project's icon from the Windows Taskbar.

Cheers,
JB
0
 
viktornetCommented:
Hello guys! Any of you know what the Task Icon is??? Do you mean the taskbar button of your app???

Regards,
Viktor Ivanov
0
 
JimBob091197Commented:
Hi Viktor

I *think* that ripcord means that the taskbar icon is (as you say) the taskbar button of your app.

JB
0
 
ripcordAuthor Commented:
ya I was talking about the taskbar button of my app. I want it to be hidden on minimzie. Then to come back when the from is restored from the tray icon. I've tried the above suggestions with the OnResize event of the form but it doesn't seem to work. This is what I tried, but it doesn't seem like the OnResize gets triggered when clicking on the minimize button.

 If (frmMain.WindowState = wsMinimized) and
    (frmOptions.chkHideTaskbar.Checked = True) Then
    ShowWindow(Application.Handle, SW_HIDE);
0
 
ripcordAuthor Commented:
Ok, but how do I get procedure MyMin(Sender : TObject);  to get exectuted when the user clicks on the min button on the form?
0
 
viktornetCommented:
Add this to your OnCreate() of the form...

Application.OnMinimize := MyMin;
Application.OnRestore := MyRes;

Regards,
Viktor Ivanov
0
 
MirkwoodCommented:
Bought This Question.
0
 
viktornetCommented:
what?
0
 
MadshiCommented:
Hi Vik, do you know the automatic "Edited Question" and "Points adjusted to XXX" comments? I guess the "Bought This Question" comment is a new automatic one...   :-)
0
 
viktornetCommented:
Wow, why dont they invent a self answering feature ;-))
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.