Gday all
I have had a bit of experience prior in Turbo Pascal and Java (Both several years ago) and I am looking to start getting back into programming for a bit of (irritating) fun.
I have spent ages searching around and running through tutorials and I am slowly starting to feel confident with the basics.
One thing I am struggling with is manipulation of the console. I am using Dev-C++ on windows vista and have just completed the tutorials on
http://www.adrianxw.dk/SoftwareSite/index.html which i found quite helpful.
In trying to get my head around console manipulation I have been working through the below code (using the code provided from the above resource)
What I cannot work out how to do is to set the position of the window to the top left of the monitor - I have seen several ways to do it but none work with what I have done
(eg.
http://msdn.microsoft.com/en-us/library/ms633534.aspx and
http://www.codeguru.com/forum/showthread.php?t=159314 )
I am SURE there was a very basic way to do it with the default window that I was messing around with a few days ago but I cant find it...
Any help would be greatly appreciated!
(I tried MoveWindow(hOut, 1, 1, 80, 80, TRUE); but no luck with using hOut as the handle?)
#include <windows.h>
#include <iostream>
using namespace std;
int main()
{
HANDLE hOut;
CONSOLE_SCREEN_BUFFER_INFO SBInfo;
COORD NewSBSize;
SMALL_RECT DisplayArea = {0, 0, 0, 0};
int x;
int y;
hOut = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(hOut,
&SBInfo);
NewSBSize.X = 175; //SET BUFFER
NewSBSize.Y = 65;
SetConsoleScreenBufferSize(hOut, NewSBSize);
x = SBInfo.srWindow.Right;
y = SBInfo.srWindow.Bottom;
DisplayArea.Top = 0;
DisplayArea.Left = 0;
DisplayArea.Bottom = 64; //SET WINDOW
DisplayArea.Right = 174;
SetConsoleWindowInfo(hOut,
TRUE,
&DisplayArea);
system("PAUSE");
GetConsoleScreenBufferInfo(hOut,
&SBInfo);
cout << "Maximum X : " << SBInfo.dwMaximumWindowSize.X << endl;
cout << "Maximum Y : " << SBInfo.dwMaximumWindowSize.Y << endl;
system("PAUSE");
return 0;
}