Thread: Detaching a program from the console

  1. #1
    Registered User trainee's Avatar
    Join Date
    Jan 2004
    Posts
    32

    Detaching a program from the console

    How would I write a program that could be run as a background process? I don't mind if it flashes for a second or two when it starts up, I just generally want it out of my way. Thank you so much.

    trainee

  2. #2
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    Since you do not want a console, I would suggest creating a Windows GUI project, but don't create any windows.

  3. #3
    Registered User trainee's Avatar
    Join Date
    Jan 2004
    Posts
    32
    Originally posted by Dante Shamest
    Since you do not want a console, I would suggest creating a Windows GUI project, but don't create any windows.
    Is there a simpler way to do this?

    trainee

  4. #4
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    I thought that was the simplest way.

    What kind of program are you trying to write? Can you give an example?

  5. #5
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    Have you tried FreeConsole().
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  6. #6
    Me -=SoKrA=-'s Avatar
    Join Date
    Oct 2002
    Location
    Europe
    Posts
    448
    >>Is there a simpler way to do this?
    There is no simpler way of doing it. replace int main() with:
    Code:
    int WINAPI WinMain(
    HINSTANCE hInstance,
    HINSTANCE hPrevInst,
    /*LPSTR*/ char* CmdLine,
    int CmdShow)
    SoKrA-BTS "Judge not the program I made, but the one I've yet to code"
    I say what I say, I mean what I mean.
    IDE: emacs + make + gcc and proud of it.

  7. #7
    Registered User trainee's Avatar
    Join Date
    Jan 2004
    Posts
    32
    Originally posted by adrianxw
    Have you tried FreeConsole().
    Yes, I found that one out from a friend. This I believe is the simplest way of doing it.

    trainee

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Client-server system with input from separate program
    By robot-ic in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-16-2009, 03:30 PM
  2. MSVC++2008 console program portability
    By CodeMonkey in forum Windows Programming
    Replies: 1
    Last Post: 11-18-2008, 03:13 AM
  3. How to avoid console program crash when terminated too early
    By Xargo in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 10-03-2007, 04:43 PM
  4. Replies: 2
    Last Post: 05-10-2002, 04:16 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM