| | |
how to set the window position of my console applicaton ?
![]() |
•
•
Join Date: Feb 2007
Posts: 12
Reputation:
Solved Threads: 0
Hi i really want to set the window position of my console applicaton
I've managed to find Console:: SetWindowPosition bu using google but cant find how to use it...
http://msdn2.microsoft.com/en-us/lib...wposition.aspx
This link shows an example.
But it wont compile
I'm guessing its missing header files, what are they?
I dont realy care how i do it, o if there is another way, then that would be great
I've managed to find Console:: SetWindowPosition bu using google but cant find how to use it...
http://msdn2.microsoft.com/en-us/lib...wposition.aspx
This link shows an example.
But it wont compile
I'm guessing its missing header files, what are they?
I dont realy care how i do it, o if there is another way, then that would be great
Last edited by kgz; Apr 28th, 2007 at 8:29 am.
Here are the win32 api console functions. include windows.h and you will probably have to have the Windows Platform SDK, free for download from Microsoft.com
First call GetConsoleWindow() to get the handle to the console window, they you can call MoveWindow() to move it to wherever you want. I have not done it myself with a console window.
First call GetConsoleWindow() to get the handle to the console window, they you can call MoveWindow() to move it to wherever you want. I have not done it myself with a console window.
Last edited by Ancient Dragon; Apr 28th, 2007 at 10:11 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
this works with VC++ 2005 Express and the Windows Platform SDK installed You have to add User32.lib to the list of link libraries.
c Syntax (Toggle Plain Text)
#include <windows.h> #include <iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { HWND hWnd = GetConsoleWindow(); MoveWindow(hWnd,100,100,300,400,TRUE); cin.ignore(); return 0; }
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
•
•
Join Date: Feb 2007
Posts: 12
Reputation:
Solved Threads: 0
I get these errors:
error C3861: 'GetConsoleWindow': identifier not found, even with argument-dependent lookup
error C2061: syntax error : identifier '_TCHAR'
I'm have not got windows sdk installed, checked and its like 800mb, is it possible just to download the specific library?
thanks
error C3861: 'GetConsoleWindow': identifier not found, even with argument-dependent lookup
error C2061: syntax error : identifier '_TCHAR'
I'm have not got windows sdk installed, checked and its like 800mb, is it possible just to download the specific library?
thanks
•
•
•
•
this works with VC++ 2005 Express and the Windows Platform SDK installed You have to add User32.lib to the list of link libraries.
c Syntax (Toggle Plain Text)
#include <windows.h> #include <iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { HWND hWnd = GetConsoleWindow(); MoveWindow(hWnd,100,100,300,400,TRUE); cin.ignore(); return 0; }
Last edited by kgz; Apr 29th, 2007 at 12:26 pm.
I don't think you can get just part of the SDK. But I think you can get it on CD for just a few $$$.
The _TCHAR allows the compiler to compile for either UNICODE or not. If your compiler doesn't understand that macro you can replace it with char
The _TCHAR allows the compiler to compile for either UNICODE or not. If your compiler doesn't understand that macro you can replace it with char
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
![]() |
Similar Threads
- Prompt window size (C++)
- Dr Scheme Tutorial (Computer Science)
- Unknown Bootup Command (Windows NT / 2000 / XP)
Other Threads in the C++ Forum
- Previous Thread: 1%2 ? what is the answer ???
- Next Thread: Issue creating a vector of a struct in C++
| Thread Tools | Search this Thread |
api array based binary bitmap business c++ c/c++ char class classes code coding commentinghelp compile console conversion count decide delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez graph guess gui homeworkhelp homeworkhelper iamthwee ifpug ifstream incrementoperators infinite input int integer java lib linkedlist linker loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem proficiency program programming project python random read recursion reference rpg string strings temperature template templates test text text-file tree url variable vector video win32 windows winsock word wordfrequency wxwidgets






