Armenian Knowledge Base  

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

Reply
 
LinkBack Thread Tools
Old 19.07.2002, 17:10   #1
Студент
 
Join Date: 06 2002
Location: California
Posts: 294
Downloads: 0
Uploads: 0
Reputation: 0 | 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
Reply With Quote
Old 19.07.2002, 17:24   #2
»
 
z0mbie's Avatar
 
Join Date: 01 2002
Posts: 777
Downloads: 1
Uploads: 0
Reputation: 0 | 0
Post

1. there's an API function - ExitWindowsEx
2. get the window handle and use ShowWindow
Reply With Quote
Old 19.07.2002, 17:30   #3
Moderator
 
acid's Avatar
 
Join Date: 09 2001
Location: South Korea, Gumi
Posts: 7,699
Downloads: 102
Uploads: 34
Blog Entries: 16
Reputation: 561 | 6
Post

SetWindowPlacement

The SetWindowPlacement function sets the show state and the restored, minimized, and maximized positions of the specified window.
Reply With Quote
Old 19.07.2002, 17:32   #4
Студент
 
Join Date: 06 2002
Location: California
Posts: 294
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Post

ok, let's start all over again.

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

thanks
Reply With Quote
Old 19.07.2002, 17:42   #5
Moderator
 
acid's Avatar
 
Join Date: 09 2001
Location: South Korea, Gumi
Posts: 7,699
Downloads: 102
Uploads: 34
Blog Entries: 16
Reputation: 561 | 6
Post

Harut, I guess it will be better for you to you read some Windows Programming book first and then try to do things.
Reply With Quote
Old 20.07.2002, 16:30   #6
Студент
 
Join Date: 06 2002
Location: California
Posts: 294
Downloads: 0
Uploads: 0
Reputation: 0 | 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.
Reply With Quote
Old 20.07.2002, 17:49   #7
Студент
 
Join Date: 06 2002
Location: Yerevan
Posts: 258
Downloads: 0
Uploads: 0
Reputation: 0 | 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
Reply With Quote
Old 20.07.2002, 20:59   #8
Студент
 
Join Date: 06 2002
Location: Yerevan
Posts: 258
Downloads: 0
Uploads: 0
Reputation: 0 | 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!
Reply With Quote
Old 20.07.2002, 21:06   #9
»
 
z0mbie's Avatar
 
Join Date: 01 2002
Posts: 777
Downloads: 1
Uploads: 0
Reputation: 0 | 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);
Reply With Quote
Old 21.07.2002, 03:42   #10
Студент
 
Join Date: 06 2002
Location: California
Posts: 294
Downloads: 0
Uploads: 0
Reputation: 0 | 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.
Reply With Quote
Old 21.07.2002, 03:53   #11
»
 
z0mbie's Avatar
 
Join Date: 01 2002
Posts: 777
Downloads: 1
Uploads: 0
Reputation: 0 | 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
....

}
Reply With Quote
Old 21.07.2002, 08:48   #12
Студент
 
Join Date: 06 2002
Location: California
Posts: 294
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Post

thanks a lot zombie.
Reply With Quote
Old 21.07.2002, 09:28   #13
Студент
 
Join Date: 06 2002
Location: Yerevan
Posts: 258
Downloads: 0
Uploads: 0
Reputation: 0 | 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 With Quote
Sponsored Links
Reply

Thread Tools


На правах рекламы:
реклама

All times are GMT. The time now is 08:20.


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