Override Application Exit - NotifyIcon.Visible = $false?

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 8 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
swatto86
Posts: 26
Last visit: Mon Jul 10, 2023 4:38 am

Override Application Exit - NotifyIcon.Visible = $false?

Post by swatto86 »

Good Evening,

Is it possible to override the Application.Exit() event of my application? The NotifyIcon stays in the taskbar when the application exits and I would like to add some code to make it disappear?

Thanks for any help.
User avatar
SAPIEN Support Forums
Posts: 945
Last visit: Thu Oct 22, 2015 1:10 pm

Override Application Exit - NotifyIcon.Visible = $false?

Post by SAPIEN Support Forums »

This is an automated post. A real person will respond soon.

Thank you for posting, Swatto86.

Here are some hints to help you get an accurate and complete answer to your question.

Ask in the best forum: If you asked in the wrong forum, just copy your question to the right forum.

Anticipate follow-up questions!

Did you remember to include the following?
  • 1. Product, version and build
    2. 32 or 64 bit product
    3. Operating system, e.g. Windows 7 64 bit.
    4. Attach a screenshot, if applicable
    5. Attach logs, crash reports, etc., in a ZIP file
If not, please take a moment to edit your original post or reply to this one.

*** Make sure you do not post any licensing information ***
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Override Application Exit - NotifyIcon.Visible = $false?

Post by jvierra »

It is not possible to know what you are asking? What application? The Notify Icon will always disappear when an application exits. I suggest that your application is not exiting.
User avatar
swatto86
Posts: 26
Last visit: Mon Jul 10, 2023 4:38 am

Re: Override Application Exit - NotifyIcon.Visible = $false?

Post by swatto86 »

Hi jvierra,

When the application exits the NotifyIcon remains in the taskbar until I wiggle my mouse over it and then it disappears, in order to stop this from happening I would like to be able to do:

$NotifyIcon.Visible = false when the user clicks the 'X' on my form?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Override Application Exit - NotifyIcon.Visible = $false?

Post by jvierra »

Sorry but there is no way to do that. Perhaps you need to delete the notify object before you close the application.
This topic is 8 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked