Thread: Running in the background.

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    182

    Running in the background.

    I want to write a program that does something in the background without needing the terminal/shell/console.

    Example: Double click the .exe (I'm on Windows XP) and create a dummy file on the folder it was, without the need of the terminal/shell/console popping up and disappearing.

    So, How do I do this?

    Thanks!

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Don't create a "console application" - create a "windows application" that doesn't create any windows.

    How you do this varies from compiler to compiler.

    gg

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    182
    I'm using MinGW.

  4. #4
    Registered User
    Join Date
    Jan 2008
    Posts
    182
    uhh... I've been searching and it looks kinda difficult.

    What's the best compiler for this? MSVC?

  5. #5
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    With MinGW, it's as easy as using the "-mwindows" linker switch.

    http://www.mingw.org/docs.shtml#compilingandbuilding

    gg

  6. #6
    Registered User
    Join Date
    Jan 2008
    Posts
    182
    Quote Originally Posted by Codeplug View Post
    With MinGW, it's as easy as using the "-mwindows" linker switch.

    http://www.mingw.org/docs.shtml#compilingandbuilding

    gg
    Hey thanks a lot! So, I just create it like the example, using WINAPI WinMain function instead... and never make a window. I had compiled that example a long of time ago, and I can't believe I didn't think of it hehe.

    Thanks again!

  7. #7
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Whe MinGW, you can also use "int main()" with "-mwindows".....if you like. But using WinMain() will make it a bit easier to compile with other compilers.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Running code in the background
    By random in forum C++ Programming
    Replies: 3
    Last Post: 12-10-2005, 02:04 PM
  2. multithreading question
    By ichijoji in forum C++ Programming
    Replies: 7
    Last Post: 04-12-2005, 10:59 PM
  3. Running A Routine in the background
    By smegly in forum C Programming
    Replies: 4
    Last Post: 05-16-2004, 06:42 PM
  4. I'm stupid, my winapp still running in background
    By Shadow12345 in forum Windows Programming
    Replies: 3
    Last Post: 01-14-2003, 09:22 PM
  5. Running program on background?
    By Couhilin in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-03-2001, 07:50 AM