i wanna make a program runs in the background and shows an icon in notification area of taskbar. I’m using win32. What api should i use? Do you know any good tutorials?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To make a program run in the background, you either add it as a service or make it “unavailable” to shutdown (for instance, hide the window for the program). To add an icon in the toolbar you use winapi. Call Shell_NotifyIcon and pass in a NOTIFYICONDATA structure
This should be defined somewhere
Also, in the below code the
hWndis aHWND, which is the window that you want to associate with the notification icon. ThisHWND'swndProcwill receive the messages for the icon.Notes:
NIF_ICONflag makes thehIconvalid in theNOTIFICATIONICONDATAstructure. So if you don’t want to have an icon, don’t specify it.NIF_MESSAGEflag makes theuCallbackMessagevalid. If you don’t want to handle any messages, don’t specify this flag.With this said, this is how you add, remove and handle the messages for the tray icon
To add the icon
To remove the icon
Handling the messages for the icon