deryckb
asked on
set a console window to full screen
In Win32, how do I change a console application's
window to full screen? i.e. the equivalent of pressing
Alt + Enter.
I'm programming in Delphi if that makes a difference.
Thanks
Deryck Brown
window to full screen? i.e. the equivalent of pressing
Alt + Enter.
I'm programming in Delphi if that makes a difference.
Thanks
Deryck Brown
You need to get the handle to the console window. The only way to do this that I've seen is with FindWindow() (but there may be a better way)
Then use SetWindowPos() on the console window handle.
Ask if you have questions.
Then use SetWindowPos() on the console window handle.
Ask if you have questions.
Opps. I missunderstood you. I thought you meant maximized, but you really do mean full screen. You can't do that the way I suggested, sorry. Madshi, idea might be the best you can do, but it does require that the console window have the focus. You can change the console window to have the focus with SetForegroundWindow() Note that this always works under win95 and Win NT 4.0. Supposidly, however, this function no longer gives another application the focus in Windows 98. However, the console can still make itself the foreground window in windows 98.
Sorry, reject my answer.
Sorry, reject my answer.
ASKER
Misunderstood the question.
Additional comment entered.
Additional comment entered.
So..... Any luck with Madshi's solution?
ASKER
I haven't had a chance to try it yet. The HD on my PC
died over the weekend. I came in on Monday and got clunk, clunk,
clunk, clunk,....
I hope to get back to it today or possibly tomorrow.
Many thanks for the suggestions so far!
died over the weekend. I came in on Monday and got clunk, clunk,
clunk, clunk,....
I hope to get back to it today or possibly tomorrow.
Many thanks for the suggestions so far!
I know the answer for NT. Its undocumented API call to SetConsoleDisplayMode.
To find it, I've wasted about two hours today.
If you are interesting in it, I'll give you it for grade A and 200 points .
Answer for 95 differs from NT one because there is no SetConsoleDisplayMode in 95. It'll cost more (I don't know the answer yet).
To find it, I've wasted about two hours today.
If you are interesting in it, I'll give you it for grade A and 200 points .
Answer for 95 differs from NT one because there is no SetConsoleDisplayMode in 95. It'll cost more (I don't know the answer yet).
How about this???
ShowWindow(TheAppHandle, SW_MAXIMIZED);
Regards,
Viktor Ivanov
ShowWindow(TheAppHandle, SW_MAXIMIZED);
Regards,
Viktor Ivanov
See my prev comment. There is an answer for W95/98 also. Undocumented, of course.
ASKER
OK, I've raised the ante to 200 points. Spill the beans! :-)
Deryck
Deryck
Here is some sample code.
It is function 0463 of kernel32.dll
#include <windows.h>
WINBASEAPI
BOOL
WINAPI
GetConsoleDisplayMode(
LPDWORD dwConsoleDisplayMode
);
WINBASEAPI
DWORD
WINAPI
SetConsoleDisplayMode(
HANDLE hConsoleHandle,
DWORD dwConsoleDisplayMode,
LPDWORD dwPreviousDisplayMode
);
void main(void)
{
HANDLE hConsole;
DWORD Result;
AllocConsole();
hConsole = GetStdHandle(STD_OUTPUT_HA NDLE);
SetConsoleDisplayMode(hCon sole, 1, &Result);
};
It is function 0463 of kernel32.dll
#include <windows.h>
WINBASEAPI
BOOL
WINAPI
GetConsoleDisplayMode(
LPDWORD dwConsoleDisplayMode
);
WINBASEAPI
DWORD
WINAPI
SetConsoleDisplayMode(
HANDLE hConsoleHandle,
DWORD dwConsoleDisplayMode,
LPDWORD dwPreviousDisplayMode
);
void main(void)
{
HANDLE hConsole;
DWORD Result;
AllocConsole();
hConsole = GetStdHandle(STD_OUTPUT_HA
SetConsoleDisplayMode(hCon
};
Have you considered using MAC address ?
Sorry, erase my last comment....
Mirkwood, I believe that was proposed by NickRepin.
ASKER
Mirkwood,
Yes your solution works, but NickRepin proposed this solution first. Therefore, in the interests of fairness, I am "rejecting" your solution to give the points to him.
Sorry!
Deryck
Yes your solution works, but NickRepin proposed this solution first. Therefore, in the interests of fairness, I am "rejecting" your solution to give the points to him.
Sorry!
Deryck
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The Windows NT solution worked for me, but a very big thanks for the 95/98 version too.
I guess alot of people were looking for this information too.
Deryck
I guess alot of people were looking for this information too.
Deryck
That should work, but the console application must have the keyboard focus.
Regards, Madshi.