Thread: Running my program in the background

  1. #1
    Registered User
    Join Date
    Jun 2005

    Running my program in the background

    ive searched the forum and not found something like what i was looking for. most of the similar topics have been ended through suspicion of potential malware usage (which is fair enough).

    ive now completed a program to process some data from a COM port and when i run it, it is using too much processor power. its a MS-DOS program run in the windows environment, which is extracting real time info from a com port.

    i want to push this program into the background so it runs silently and preferably with a small icon in the taskbar. hopefully, this will reduce processor power, am i right? if not, then i wont bother but if it will, can someone point me in the right direction?


  2. #2
    Registered Luser cwr's Avatar
    Join Date
    Jul 2005
    Sydney, Australia
    I'm not familiar with Windows multi-tasking, it might be brain damaged, but most operating systems will give a program all the available CPU time it requests. That is, regardless of whether something is "running in the background" or not, a for ( ; ; ) ; infinite loop (for example) will thrash all free CPU time. This won't necessarily mean that other programs will be less responsive, because the operating system will preempt the process and force a context switch.

    On the other hand, if a program that is IO bound (like your COM port example should be), the process will block while waiting for data from this port, and the operating system will decide not to waste time and give the CPU over to another process. Either way, "backgrounding" won't have much effect.

    As for how to do this, it really has nothing to do with the C language, because it's a platform specific feature. This thread should probably be moved to "Windows Programming"
    Last edited by cwr; 10-07-2005 at 06:52 AM. Reason: emoticon interpolation caused my for loop to go happy.

  3. #3
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    The easiest way is to make it a GUI program, and if you don't make any window in your GUI program, it is just like it runs in the background.

  4. #4
    Registered User
    Join Date
    Jun 2005
    thanks alot guys

  5. #5
    The N00b That Owns You!
    Join Date
    Jul 2005
    try this tutorial it should vcover this and future questions:
    New Function!!!!


    The feeling of rusty spoons against my salad fingers is almost ORGASMIC

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 01:42 AM
  2. How to tell when internal program is done running
    By PJYelton in forum Windows Programming
    Replies: 5
    Last Post: 03-21-2005, 10:09 PM
  3. Running my program.....estimated to take 55 hrs...
    By AssistMe in forum C Programming
    Replies: 14
    Last Post: 03-21-2005, 12:46 AM
  4. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 12:39 PM
  5. Running program on background?
    By Couhilin in forum A Brief History of
    Replies: 1
    Last Post: 11-03-2001, 07:50 AM