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? ... :-)
- Create a window but don't show it.
- 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.
精彩评论