![](https://forum.armkb.com/images/enlighten/misc/cat_top_ls.gif) |
some ?s |
![](https://forum.armkb.com/images/enlighten/misc/cat_top_rs.gif) |
19.07.2002, 16:10
|
#1
|
Студент
Join Date: 06 2002
Location: California
Posts: 294
Rep Power: 0
|
some ?s
hi, i have 2 ?s.
how can i shut down Windows with BV or C++?
is there any such statement or object that i can use?
at least, how can i display the shut down box?
one more thing.
how can i miximize my output window in C++? with code, not manualy.
thank you
|
|
|
19.07.2002, 16:24
|
#2
|
»
Join Date: 01 2002
Posts: 777
Rep Power: 0
|
1. there's an API function - ExitWindowsEx
2. get the window handle and use ShowWindow
|
|
|
19.07.2002, 16:30
|
#3
|
Moderator
Join Date: 09 2001
Location: South Korea, Gumi
Posts: 7,699
Rep Power: 7
|
SetWindowPlacement
The SetWindowPlacement function sets the show state and the restored, minimized, and maximized positions of the specified window.
|
|
|
19.07.2002, 16:32
|
#4
|
Студент
Join Date: 06 2002
Location: California
Posts: 294
Rep Power: 0
|
ok, let's start all over again.
1. what's an API?
2. what's a window handle?
thanks
|
|
|
19.07.2002, 16:42
|
#5
|
Moderator
Join Date: 09 2001
Location: South Korea, Gumi
Posts: 7,699
Rep Power: 7
|
Harut, I guess it will be better for you to you read some Windows Programming book first and then try to do things.
|
|
|
20.07.2002, 15:30
|
#6
|
Студент
Join Date: 06 2002
Location: California
Posts: 294
Rep Power: 0
|
yes acid, i'm getting way ahead of my level and what i know, but, you know, that's how we learn.
i figured out the shut down thing just after posing my last message.
and my second ? was a wrong one.
i need to make the output full screen. it is in console window.
so if you can help, i'll be thankful.
|
|
|
20.07.2002, 16:49
|
#7
|
Студент
Join Date: 06 2002
Location: Yerevan
Posts: 258
Rep Power: 0
|
Quote:
Originally posted by _Harut_:
i need to make the output full screen. it is in console window.
so if you can help, i'll be thankful.
|
Of the top of my head there is no easy way to make a full-screen console.
The only way that comes to my mind, is to create a win32 full screen window, and create a pipe in it, which will be linked to console stdin, stdout and stderr. But I don't think that's a beginner problem to solve.
|
|
|
20.07.2002, 19:59
|
#8
|
Студент
Join Date: 06 2002
Location: Yerevan
Posts: 258
Rep Power: 0
|
Good news
I just looked up the documentation, and if you run that console using CreateProcess, and set dwFlags in startupinfo to STARTF_RUNFULLSCREEN, it will work for console windows! (under WinNT/2000 and later)
e.g.
Code:
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof( si ) );
si.cb = sizeof( STARTUPINFO );
si.dwFlags = STARTF_RUNFULLSCREEN;
CreateProcess( NULL, "cmd.exe", NULL, NULL, FALSE, NULL,
NULL, NULL, &si, &pi );
Have fun!
|
|
|
20.07.2002, 20:06
|
#9
|
»
Join Date: 01 2002
Posts: 777
Rep Power: 0
|
Eddi po moemu nuzno bыlo chtob console application sama sebya pereklyuchila v fullscreen, vot kak mozhno(win2000/xp)
Code:
typedef BOOL (WINAPI *PROCSETCONSOLEDISPLAYMODE)(HANDLE,DWORD,LPDWORD);
typedef BOOL (WINAPI *PROCGETCONSOLEDISPLAYMODE)(LPDWORD);
PROCSETCONSOLEDISPLAYMODE SetConsoleDisplayMode;
PROCGETCONSOLEDISPLAYMODE GetConsoleDisplayMode;
HMODULE hKernel32 = GetModuleHandle("kernel32");
SetConsoleDisplayMode = (PROCSETCONSOLEDISPLAYMODE ) GetProcAddress(hKernel32,"SetConsoleDisplayMode");
GetConsoleDisplayMode = (PROCGETCONSOLEDISPLAYMODE) GetProcAddress(hKernel32,"GetConsoleDisplayMode");
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD dwOldMode;
SetConsoleDisplayMode(hOut,1,&dwOldMode);
|
|
|
21.07.2002, 02:42
|
#10
|
Студент
Join Date: 06 2002
Location: California
Posts: 294
Rep Power: 0
|
thanks people.
even though i didn't understand most of the codings you provided, it looks promising.
now if you tell me where to put that piece of code, that wiil help.
do i insert it just in my main() function? if so, what header files do i need?
or do i save it in separate header file and include it in my main file?
thanks again.
|
|
|
21.07.2002, 02:53
|
#11
|
»
Join Date: 01 2002
Posts: 777
Rep Power: 0
|
Code:
#include <windows.h>
void FullScr(){
typedef BOOL (WINAPI *PROCSETCONSOLEDISPLAYMODE)(HANDLE,DWORD,LPDWORD);
typedef BOOL (WINAPI *PROCGETCONSOLEDISPLAYMODE)(LPDWORD);
PROCSETCONSOLEDISPLAYMODE SetConsoleDisplayMode;
PROCGETCONSOLEDISPLAYMODE GetConsoleDisplayMode;
HMODULE hKernel32 = GetModuleHandle("kernel32");
SetConsoleDisplayMode = (PROCSETCONSOLEDISPLAYMODE )
GetProcAddress(hKernel32,"SetConsoleDisplayMode");
GetConsoleDisplayMode = (PROCGETCONSOLEDISPLAYMODE)
GetProcAddress(hKernel32,"GetConsoleDisplayMode");
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD dwOldMode;
SetConsoleDisplayMode(hOut,1,&dwOldMode);
}
....
int main(){
.....
FullScr(); // use where u need it
....
}
|
|
|
21.07.2002, 07:48
|
#12
|
Студент
Join Date: 06 2002
Location: California
Posts: 294
Rep Power: 0
|
thanks a lot zombie.
|
|
|
21.07.2002, 08:28
|
#13
|
Студент
Join Date: 06 2002
Location: Yerevan
Posts: 258
Rep Power: 0
|
If you want to do the same trick for windows 9x/me, you can use this:
Code:
DWORD dwThread = GetCurrentThreadId( );
PostThreadMessage( dwThread, WM_COMMAND,0xE00F,0);
This will switch the console mode (so you may consider reading, what's the default console mode from HKEY_CURRENT_USER/Console/FullScreen). Don't forget to include windows.h
|
|
|
All times are GMT. The time now is 02:13. |
|
|