Go Back   Armenian Knowledge Base > Technical sections > Languages, Compilers, Interpreters

Reply
 
Thread Tools

some ?s
Old 19.07.2002, 16:10   #1
Студент
 
Join Date: 06 2002
Location: California
Posts: 294
Rep Power: 0
Post 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

Old 19.07.2002, 16:24   #2
»
 
z0mbie's Avatar
 
Join Date: 01 2002
Posts: 777
Rep Power: 0
Post

1. there's an API function - ExitWindowsEx
2. get the window handle and use ShowWindow

Old 19.07.2002, 16:30   #3
Moderator
 
acid's Avatar
 
Join Date: 09 2001
Location: South Korea, Gumi
Posts: 7,699
Blog Entries: 16
Rep Power: 7
Post

SetWindowPlacement

The SetWindowPlacement function sets the show state and the restored, minimized, and maximized positions of the specified window.

Old 19.07.2002, 16:32   #4
Студент
 
Join Date: 06 2002
Location: California
Posts: 294
Rep Power: 0
Post

ok, let's start all over again.

1. what's an API?
2. what's a window handle?

thanks

Old 19.07.2002, 16:42   #5
Moderator
 
acid's Avatar
 
Join Date: 09 2001
Location: South Korea, Gumi
Posts: 7,699
Blog Entries: 16
Rep Power: 7
Post

Harut, I guess it will be better for you to you read some Windows Programming book first and then try to do things.

Old 20.07.2002, 15:30   #6
Студент
 
Join Date: 06 2002
Location: California
Posts: 294
Rep Power: 0
Post

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.

Old 20.07.2002, 16:49   #7
Студент
 
Join Date: 06 2002
Location: Yerevan
Posts: 258
Rep Power: 0
Post

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.
__________________
http://www.d-brane.com

Old 20.07.2002, 19:59   #8
Студент
 
Join Date: 06 2002
Location: Yerevan
Posts: 258
Rep Power: 0
Post

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!

Old 20.07.2002, 20:06   #9
»
 
z0mbie's Avatar
 
Join Date: 01 2002
Posts: 777
Rep Power: 0
Post

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);

Old 21.07.2002, 02:42   #10
Студент
 
Join Date: 06 2002
Location: California
Posts: 294
Rep Power: 0
Post

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.

Old 21.07.2002, 02:53   #11
»
 
z0mbie's Avatar
 
Join Date: 01 2002
Posts: 777
Rep Power: 0
Post

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(&quot;kernel32&quot;);
SetConsoleDisplayMode = (PROCSETCONSOLEDISPLAYMODE )
GetProcAddress(hKernel32,&quot;SetConsoleDisplayMode&quot;);
GetConsoleDisplayMode = (PROCGETCONSOLEDISPLAYMODE)
GetProcAddress(hKernel32,&quot;GetConsoleDisplayMode&quot;);
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD dwOldMode;
SetConsoleDisplayMode(hOut,1,&dwOldMode);
}

....


int main(){
.....
FullScr(); // use where u need it
....

}

Old 21.07.2002, 07:48   #12
Студент
 
Join Date: 06 2002
Location: California
Posts: 294
Rep Power: 0
Post

thanks a lot zombie.

Old 21.07.2002, 08:28   #13
Студент
 
Join Date: 06 2002
Location: Yerevan
Posts: 258
Rep Power: 0
Post

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
Reply




Реклама:
реклама

All times are GMT. The time now is 02:13.
Top

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.