Click here to Skip to main content
15,897,226 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I building an application in MFC, i want my application to be continuously run in a hidden mode,So kindly can you guide in which function should i cal my functions so that they are called continuously in my APP.

For example like taskmanager ,it runs continously and it gets updated in runtime also i want to have it in the same way.

I will be thank full i you kindly help me out in this
Posted

1 solution

Best would be a Windows Service.

see : Writing Windows Services - Made easy[^]

Few basic tips related to Windows Service

Installation

Open Visual Studio Command Prompt(Start>All Programs > Vistal Studio 20xx > Visual Studio Tools > Visual Studio Command Prompt.
Type in the following at command prompt to install the service

C#
installutil "C:\Folder1\Folder2\Yourservice.exe"

Uninstallation

Open Visual Studio Command Prompt(Start>All Programs > Vistal Studio 20xx > Visual Studio Tools > Visual Studio Command Prompt.
Type in the following at command prompt to uninstall the service.

C#
installutil /u "C:\Folder1\Folder2\Yourservice.exe"

Start/stop Windows Service
Open Command Prompt(Start>Run type in cmd will launch Command Prompt).
Next
Start the Service
C#
net start Yourservicename

Stop service
C#
net stop Yourservicename
 
Share this answer
 
v2
Comments
Member 9274864 6-Sep-12 2:27am    
Hi Kuthuparakkal thanks for the immmediate reply

1)The above code is useful for me for the other application which iam building.
So i need to add the .cpp and .h files in my code and take the instance of the CXServiceManager and call the CreateService function.

But how do i exactly use this to install it in the registries and to start the application when the applications boots.

2)And one more thing to ask you,i need a function in which i can keep my code so that it can be called continuously.I have written a code for list control and it gets updated only when the user clicks the refresh button,now i want to call that refresh button automatically with clicking any button for that i need a function which call continuously so that i can cal my function in it.
Kuthuparakkal 6-Sep-12 3:29am    
see my soln updated
Member 9274864 6-Sep-12 4:43am    
Thanks for the solution ,but what about the second question ,do u have any idea about that.

2)And one more thing to ask you,i need a function in which i can keep my code so that it can be called continuously.I have written a code for list control and it gets updated only when the user clicks the refresh button,now i want to call that refresh button automatically with clicking any button for that i need a function which call continuously so that i can cal my function in it.
Kuthuparakkal 6-Sep-12 6:16am    
what do you mean by continuously.. can you post some pseudo logic or pseudo code.
Member 9274864 6-Sep-12 6:49am    
I have a function for updating data in the list control , i have called this function in the OnInitDialog() and this function is called only once while initializing , but i want that list control to be updated continuously in the run time,as that list control runs in the backround in the hidden mode.So kindly suggest where should i call that function so that function gets called in the run time with out clicking any button or any thing...

So i checking out for a function which i always called ,so that i can declare my function in it, through which my list control gets updated continously

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900