Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Background process

Status
Not open for further replies.

maluk

Programmer
Oct 12, 2002
79
SG
How do I make my program as a background process in MSVC++ 6.0? Rome did not create a great empire by having meetings, they did it by
killing all those who opposed them.

- janvier -
 
Not actually a VC++ issue.

There are several ways of doing this programmatically:-

1) Write a 'stub' executable which does a CreateProcess on the actual program you want as a background process. CreateProcess lets you set the 'priority' you want the new process to run at.

2) Call SetThreadPriority within the program you want to run in the background to change priority of your program's thread(s).
 
Maluk,

Do you want a Service as in an NT Service?

-pete
 
palbano,

nope. not a service nor an NT service.
my goal would just be a regular win32 application that runs in the background.


temps,

what is a 'stub' executable?


guys,

what i have in mind is a process is running on the background then if certain conditions are met, it will dispay a dialog box. Rome did not create a great empire by having meetings, they did it by
killing all those who opposed them.

- janvier -
 
>> what i have in mind is a process is running on the
>> background then if certain conditions are met, it will
>> dispay a dialog box.

Running in the background of what? Perhaps you could clarify your requirements.

-pete
 
> Running in the background of what?

Right. You must write simply application without output window - thats all. In multitasking OS each application runs "in background".
 
sorry for being vague.
"running on the background" means running like a daemon. Rome did not create a great empire by having meetings, they did it by
killing all those who opposed them.

- janvier -
 
What difference do you see between a "daemon" and ordinary Windows application? In Unix daemons are applications, not occupying terminal window. May be your qestion may sound like "how to create an application without output window?"
 
>> "running on the background" means running like a daemon.

Yeah, ok... lets start over shall we. A daemon in Windows is a NT Service.

There is an NT Service ATL Wizard in VC++ 6. I have used many times. Also a standard Win32 console application can be made to run as a service using SRVANY which comes in the NT Resource Kit. You can even turn a Java application running on the SUN VM into an NT Service using SRVANY

Hope this helps
-pete
 
Probably 'stub' program is a bit unclear - we tend to use the term for a program who's only intention in life is to launch another program.

Not really sure what your requirement is having seen some of the discussions in this thread. However, if you want the 'background' program to be available without a user logged on, then you must use an NT Service to achieve this.

 
i think what i need is a windowless application that uses executes at low priority. Rome did not create a great empire by having meetings, they did it by
killing all those who opposed them.

- janvier -
 
Well that still leaves a wide variety of options. How about starting with something simple?

Make a basic MFC dialog based app and don't show the main window. This will give you a free message pump that you can hook into if needed.

Then... staying with real basic stuff here, use a timer to signal your processing event. See SetWaitableTimer() API for that part.

Can't think of anything else can you?

Hope this helps
-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top