Detaching a program from the console

This is a discussion on Detaching a program from the console within the Windows Programming forums, part of the Platform Specific Boards category; How would I write a program that could be run as a background process? I don't mind if it flashes ...

  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
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    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
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    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,831
    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, 05:43 PM
  4. Replies: 2
    Last Post: 05-10-2002, 05:16 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 11:04 PM

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