PDA

View Full Version : working with the console window



chuck norrrissss
03-28-2011, 05:12 AM
hi,
when i run my program, i get a 'console' window and then the openGL window (i think that is what its called?) in front of the 'console' window.

i want to position and resize the 'console' window, how can i do that? is it easy?

thanks!

ZbuffeR
03-28-2011, 05:20 AM
That is you OS/window manager that does that automatically.
There are very few controls for this default console.

McLeary
03-28-2011, 09:55 AM
It is more easy translate your OpenGL window to a position that do note overlaps the console instead of try to move the console window.

MaxH
03-28-2011, 02:15 PM
i want to position and resize the 'console' window, how can i do that? is it easy? Assuming you're running on Windows, it's easy. But you don't do it from within the OpenGL program.

Here's how: 1) run your OGL program, 2) right mouse click on the top border of the console window, 3) a menu will come up, 4) click on 'Properties' (the last choice on my system), 5) this brings up a control panel with 5 tabs which let you set the size, color, position, font, etc., of the console window. After entering all your settings you will be asked if you want the system to remember the settings. It will do so, but only for the system you're on, and only if you execute the program the same way you did for the session in which you made the settings. The settings won't be remembered if you run your code on another computer. They would have to be reentered. So this is a partial solution to your problem. However I use it ALL the time and find it very useful.

McLeary
03-28-2011, 02:44 PM
Here's how: 1) run your OGL program, 2) right mouse click on the top border of the console window, 3) a menu will come up, 4) click on 'Properties' (the last choice on my system), 5) this brings up a control panel with 5 tabs which let you set the size, color, position, font, etc., of the console window. After entering all your settings you will be asked if you want the system to remember the settings. It will do so, but only for the system you're on, and only if you execute the program the same way you did for the session in which you made the settings. The settings won't be remembered if you run your code on another computer. They would have to be reentered. So this is a partial solution to your problem. However I use it ALL the time and find it very useful.

It is a solution. The first time I read the post I thought that the objective was to move the console window dynamically, depending on some internal program state.

chuck norrrissss
03-29-2011, 12:24 AM
thank you for that 'solution' which is great and works but i was hoping for a more 'general solution'.

basically i wanted to move and resize the console window once the program starts so it is off to the side while my OGL window is on the other side.

surely there must be a way to manipulate that console window? other example programs that i have run don't even have the console window present but i need it to show important messages while my code is running.

maybe there is another way?
thanks for all the suggestions!!!

ZbuffeR
03-29-2011, 12:59 AM
You should do that totally differently.
For example, disable this default console (compile options), and just use a large GL window, you will have full control to put on one side the normal rendering, and on the other side the text console rendered with OpenGL.
This may help you :
http://www.robots.ox.ac.uk/~gsibley/GLConsole/

mobeen
03-29-2011, 01:55 AM
thank you for that 'solution' which is great and works but i was hoping for a more 'general solution'.

basically i wanted to move and resize the console window once the program starts so it is off to the side while my OGL window is on the other side.

surely there must be a way to manipulate that console window?
You can move the console window by using the SetWindowPos WinAPI function like this,


SetWindowPos(GetConsoleHwnd(),NULL,left,top,width, height,0);


GetConsoleHwnd is implemented as follows,


HWND GetConsoleHwnd(void)
{
#define MY_BUFSIZE 1024 // Buffer size for console window titles.
HWND hwndFound; // This is what is returned to the caller.
char pszNewWindowTitle[MY_BUFSIZE]; // Contains fabricated
// WindowTitle.
char pszOldWindowTitle[MY_BUFSIZE]; // Contains original
// WindowTitle.
// Fetch current window title.
GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);

// Format a "unique" NewWindowTitle.

wsprintf(pszNewWindowTitle,"%d/%d",
GetTickCount(),
GetCurrentProcessId());

// Change current window title.

SetConsoleTitle(pszNewWindowTitle);

// Ensure window title has been updated.

Sleep(40);

// Look for NewWindowTitle.

hwndFound=FindWindow(NULL, pszNewWindowTitle);

// Restore original window title.

SetConsoleTitle(pszOldWindowTitle);

return(hwndFound);
}


See if this is whats u wanted?

chuck norrrissss
03-29-2011, 02:34 AM
thanks for that, will give it a try shortly....

chuck norrrissss
03-30-2011, 07:37 AM
well in the end i used the original solution for a few days and today i was able to get rid of the console and use the window in nearly full screen which works out well. am also putting any messages onto the main window now too :)

thanks again!