Hack Forums
[C] Hide Console Window (No Fast Console Open/Close) - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C] Hide Console Window (No Fast Console Open/Close) (/showthread.php?tid=4108577)



Hide Console Window (No Fast Console Open/Close) - Bandors Jr. - Mar 10, 2014

So I've tried a bunch of ways to hide the window.

IE:
Spoiler (Click to View)
etc etc. But they all flash the console before closing it.

Then I tried MoveWindow()

Code
int main()
{
    MoveWindow( GetConsoleWindow(), 0, 0, 0, 0, TRUE);
        // do whatever code bla bla bla
    return 0;
}

I'm very new to C++ and this was just for my Download&Execute project but it was a bitch having the console flash, not to mention a bit suspicious. More of you experience users won't need this, but ya.


* - Sajuuk - Mar 10, 2014

Why not just use WinMain as the entry point? Much easier...


* - Bandors Jr. - Mar 10, 2014

(Mar 10, 2014 10:31 PM)Sajuuk Wrote:  Why not just use WinMain as the entry point? Much easier...

IDK, I'm new and this is what worked for me :P


* - jessman420 - Mar 11, 2014

Assuming you use visual studio....

The easiest way to accomplish this is create a new project in visual studio, as a console, and in creation options, make it a win32 project, and tick empty project. Then add your main.cpp and add a winmain for an entry point, in lieu of int main(), like you would do with a console..

This will create a completely hidden (console window only) application with no window flash. This can be used for background processes, key loggers, stubs etc.


* - Qmz_ - Mar 11, 2014

Or just set subsystem to windows and
#pragma comment(linker,"/ENTRY:main")


* - Sajuuk - Mar 11, 2014

(Mar 11, 2014 06:09 AM)jessman420 Wrote:  Assuming you use visual studio....

The easiest way to accomplish this is create a new project in visual studio, as a console, and in creation options, make it a win32 project, and tick empty project. Then add your main.cpp and add a winmain for an entry point, in lieu of int main(), like you would do with a console..

This will create a completely hidden (console window only) application with no window flash. This can be used for background processes, key loggers, stubs etc.

I use Code::Blocks and virtually do the same thing.


* - notsteve - Mar 11, 2014

Additionally, you can prevent your hwnd from being enumerated by a message-only window, which will still allow you to have a message loop (use timers & whatnot).


* - dream_man - Apr 14, 2014

I'm using just FreeConsole(); fast and no code :P