Background process

This is a discussion on Background process within the C Programming forums, part of the General Programming Boards category; Hi! I'm writting a C++ MS-DOS application that has nothing to output on screen, but still there is a window ...

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    14

    Background process

    Hi! I'm writting a C++ MS-DOS application that has nothing to output on screen, but still there is a window that opens and closes after a very short time. How can I make it run in the background? 10x..

  2. #2
    Slave MadCow257's Avatar
    Join Date
    Jan 2005
    Posts
    735
    Look up Windows Application programming to see how to set up an application w/o a window. If you want closs platform look up libSDL and it will make it really easy to set up windowless applications

  3. #3
    Mad OnionKnight's Avatar
    Join Date
    Jan 2005
    Location
    Umeň, Sweden
    Posts
    555
    Replace your main function with:
    Code:
    int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
    And #include <windows.h> at the top.
    You don't have to worry about the crazy parameters and stuff but it's worth noting that lpCmdLine is a string containing the command line parameters passed to the program. Sadly there's no argc and argv for Windows programming.
    You also need to tell the compiler that it's a Windows program so that it won't be looking for a main() function.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 11-04-2008, 04:28 AM
  2. Problem with forking a process
    By Unitedroad in forum C Programming
    Replies: 10
    Last Post: 10-04-2007, 02:43 AM
  3. process programming
    By St0rM-MaN in forum Linux Programming
    Replies: 2
    Last Post: 09-15-2007, 08:53 AM
  4. Linux: Send keyboard input to background process
    By xErath in forum Tech Board
    Replies: 2
    Last Post: 12-09-2004, 07:02 PM
  5. Detect Close of a background process
    By Schwarzhelm in forum C Programming
    Replies: 1
    Last Post: 11-05-2003, 01:46 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21