"Un-hiding" a process.

I'm making a program for testing purposes, that will start up hidden, but will show when an input is made. So far, I can not find anything on this. I want my program to re-instate it's regular console mode and I cant figure out how to do that. Basically, I want to undo this:

HWND stealth;
    stealth = FindWindowA("ConsoleWindowClass", NULL);
    ShowWindow(stealth, 0);

Thank you for your time
The fragment you posted looks dangerous. By looking for the console window by class, you might end up with the handle for another console's window. See "How To Obtain a Console Window Handle (HWND)"


PS For people passing by, 0 and 5 should -- of course -- be replaced by the constants SW_HIDE and SW_SHOW ("Avoid magic number": point #17, C++ Coding Standards, Sutter and Alexandrescu).
Last edited on
Topic archived. No new replies allowed.