HWND consoleWindowHandle = GetConsoleWindow();
if( consoleWindowHandle ){
cout << endl << "Setting up associated console window ON TOP !";
SetWindowPos(
consoleWindowHandle, // window handle
HWND_TOPMOST, // "handle to the window to precede
// the positioned window in the Z order
// OR one of the following:"
// HWND_BOTTOM or HWND_NOTOPMOST or HWND_TOP or HWND_TOPMOST
0, 0, // X, Y position of the window (in client coordinates)
0, 0, // cx, cy => width & height of the window in pixels
SWP_DRAWFRAME | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW // The window sizing and positioning flags.
);
// OPTIONAL ! - SET WINDOW'S "SHOW STATE"
ShowWindow(
consoleWindowHandle, // window handle
SW_NORMAL // how the window is to be shown
// SW_NORMAL => "Activates and displays a window.
// If the window is minimized or maximized,
// the system restores it to its original size and position.
// An application should specify this flag
// when displaying the window for the first time."
);
cout << endl << "Done.";
} else {
cout << endl << "There is no console window associated with this app :(";
}
So I need to make this console app always on top and have possibility to alt tab to this application by some windows lib function.
Big thanks in advance
I don't know if you can rig code to make those same things happen easily or not. Its not at the program level, its at the shell level ... but maybe the program can tamper with its own shell to save, set, and restore the values?