Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is the Win32 API used in C++ to minimize a window to the system tray?

Pretty much a self-explanatory title. I'm writing an application in C++ with the Win32 API, and I'd like to know how to minimize to the system tray. I can find all kinds of articles online about minimizing to the system tray in C#, Python, even Visual Basic, I think, but for the life of me I can not find a single article on how to minimize something to the system tray in C++.

Any and all help or even redirection would be highly appreciated.

EDIT: Question answered. Once I knew about the Shell_NotifyIcon function, I was easily able to find this CodeProject article which is exactly what I needed.

like image 982
Ken Bellows Avatar asked Jan 30 '11 17:01

Ken Bellows


People also ask

How minimize windows form to system tray in C#?

This can be done by doing the following in your form's Resize event handler: Check whether the form's WindowState property is set to FormWindowState. Minimized. If yes, hide your form, enable the NotifyIcon object, and show the balloon tip that shows some information. Once the WindowState becomes FormWindowState.

What does Minimise to system tray mean?

To interact with a program in the system tray, select an icon with the mouse and double-click or right-click the icon. When minimizing the program after using it, it shrinks back into the system tray instead of into the main part of the taskbar.

Is Win32 API written in C?

The windows API is implemented in the C programming language.


1 Answers

All you need is the Shell_NotifyIcon function. You ought to be able to work it out from MSDN, but if you need more help I'm sure there are a million places on the web that give samples. Now that you know the name of the API, web search will fill in the gaps.

like image 112
David Heffernan Avatar answered Oct 01 '22 13:10

David Heffernan