Hide Console

closed account (G26pX9L8)
Hello,

ive made a console program and now i want to run it in the background so nothing appeard on screan. It should be something like svchost.exe who's always running too. but i don't wanna user FreeConsole() because it looks like the program starts and disappears immediately. anybody who can help me?
Now just what would be the purpose of a console program running in the background, without a window? Sorry, but whenever we hear that someone wants something running in the background, we do a routine intensions check.

-Albatross
hello bunny,

well i am not expert in programming but i hide my console through windows api

i think it was ShowWindow , look msdn for details.

(well i think you should not do this , even i did it before).
If ShowWindow would work in this case, it would be the same problem with the flicker as in FreeConsole...

Create an Windows-application... not a normal console application...
closed account (G26pX9L8)
All right, how can i make a simple windows applicatio that runs in the background? cause now ive only a console program, so how to convert that?
What exactly do You want to do?;)... (I collaborate with albatross and enquiring :P)...
closed account (G26pX9L8)
Ive made a windowd applicatio and now i can easily hide the screen by using ShowWindow(hwnd, SW_HIDE); but when i compile the program and run is i see a console screen behind my window application. That is just awful, does somebody know how to fix this? Please help me i almost solved this problem.
Last edited on
closed account (G26pX9L8)
Can anybody help me?
if you just want hide the console (for windows):
1
2
3
4
5
6
7
8
9
10
11
12
#include<windows.h>
#include<iostream>
int main(void)
{
    HWND hwnd_win = GetForegroundWindow();
    ShowWindow(hwnd_win,SW_HIDE);
    _sleep(4000);
    ShowWindow(hwnd_win,SW_SHOW);
    std::cout<<"it's worked?????";
    system("pause >nul");
    return 0;
}

I hope this help...
closed account (G26pX9L8)
Yeah, this worked, but it is not the solution. When i start the porgram i see the console and it disappeard directly and after that my real window app starts. This is not the way i want to fix it and none of the apps i see have a console window behind the real application window. Any other ideas?
In that case you will have to use WinMain() instead of main().
http://msdn.microsoft.com/en-us/library/ms633559(VS.85).aspx

-Albatross
closed account (G26pX9L8)
@Albatross
of course i did

@all
thanks for helping me, my problem is fixed now because I had just set the compiler to GUI instead of console.
Topic archived. No new replies allowed.