Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do VC++ set the Size and 'Topmost' of a console window?

Status
Not open for further replies.

mathewzhao

Technical User
Nov 13, 2006
1
CN
(IDE: VC++ 6.0 OS: WinXP SP2 )
I looked up MSDN and found the API function'SetConsoleWindowInfo ' ,which can

resize,according to MSDN, the size and position of a console window, however,I tried

it and found it doesn't work at all.I don't understand why the API doesn't work on my PC.


Some books says the API function,SetWindowPos,can changes Z order of a child, pop-

up, or top-level window.I want to set the console window as the topmost window,so I

use the API function ,but I don't know how to get the handle of a console window,I

tried to get a console handle by the sentence, wHnd = GetStdHandle(STD_OUTPUT_HANDLE);
Unfortunately,I got the following error message:
error: argument of type "HANDLE" is incompatible with parameter of type "HWND".

Could anyone give me some suggestions? Thanx!
 
Getting the window handle of a console can be done by calling API :
HWND GetConsoleWindow (void);

Unfortunately GetConsoleWindow only works on W2000 and XP, not NT4 and 9x/ME.
If you have one of these systems, read this thread207-530515



Marcel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top