How to keep my program running in the background?



  • HI, everyone. This is my first post,it might have a lot of mistakes. If there is anything confusing I will rephrase my post ASAP.
    I am writing a program that keeps scanning a certain directory checking if there is new files added to that location. I want it keeps running in background and having an icon in notification area just like Antivirus programs. Right clicking the Icon in notification area will allow me to change the setting of that program or quit.
    What confusing me is :
    How can I keep this program running ?
    How to show a icon in notification area?
    It mainly works on Windows 8. It would be perfect if it can be extended to other version of Windows. I am not considering Mac or Linux etc.
    I am eager to learn all the missing knowledge that makes me ask those silly questions. You are more than appreciated if you can recommend some books about this Or tell me how to find them if they were already mentioned in Qt document.
    Thank you very much.


  • Moderators

    Hi @PandaBoy,
    I think what you are looking for is QSystemTrayIcon. An example here. It will also be in your Qt installed directory.



  • Hi and welcome to devnet,

    to show icon you can use QSystemTrayIcon.

    to keep the application running you could create it as a Windows Service.
    If you wont to create a Windows-only application you can also have a look to this


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.