| | |
how to set the window position of my console applicaton ?
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
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++
Views: 5286 | Replies: 6
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays based beginner binary c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer display dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator givemetehcodez graph iamthwee ifstream image input int java lib list loop looping loops map math matrix memory multiple newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg search simple sort sorting spoonfeeding string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






