开发者

How to minimize to system tray in C

开发者 https://www.devze.com 2023-04-12 07:32 出处:网络
How can I minimize my app to the system tra开发者_如何学运维y as soon as it starts in C? I am new to C.

How can I minimize my app to the system tra开发者_如何学运维y as soon as it starts in C?

I am new to C.

Thanks.


Are you talking about Windows and the taskbar status area? If so, check http://msdn.microsoft.com/en-us/library/windows/desktop/bb762159.aspx for the Shell_NotifyIcon function. There are plenty of references, and even some samples linked on how to use it.

Also Notifications and the Notification Area: http://msdn.microsoft.com/en-us/library/windows/desktop/ee330740.aspx


C, all by itself, is not capable of doing what you want. The language was designed to work on as many possible architectures as possible (microwave ovens ... air bag systems ... mouse movement control ...) and not all such architectures know what a "system tray" is.

You need to use specific libraries (which augment the capabilities of Standard C). There are lots and lots (and lots) of external libraries. Most libraries to do the same thing on different platforms are not compatible between each other ... so we need to know what is the target of your code: Windows? Windows Vista? DOS? microwave oven? sattelite solar panel deployer? ... :-)


  1. Create a window but don't show it.
  2. Use Shell_NotifyIcon to create the icon in the notification area.

In order to perform step 2 you will need the window created in step 1.

If you have never programmed in C before and never used the Win32 API before this is an ambitious first project. First of all you should master the basics of showing windows, programming a message loop, handling messages etc. I recommend Programming Windows by Petzold.

0

精彩评论

暂无评论...
验证码 换一张
取 消