Página 1 de 1
Tela cheia (FULLSCREEN)
Enviado: 26 Ago 2005 17:50
por MARCELOG
Sempre procurei isto e, até então, não havia encontrando.
Assim, pra quem quiser aproveitar a dica, uma função em C que acaba com a celeuma da tela cheia no windows.
É so chamar a função TESTE() e... buuuuummmmm ... tela cheia!
Código: Selecionar todos
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
HB_FUNC (TESTE)
{
BOOL ok = FALSE;
#define CON_GUID TEXT("CON_GUID-{68E311EF-BF32-4b0f-8D35-E84E4A463096}")
HWND hConWnd = NULL;
WPARAM magic = 57359;
TCHAR szTempTitle[] = CON_GUID;
TCHAR szTempString[MAX_PATH];
if ( GetConsoleTitle(szTempString, sizeof(szTempString)/sizeof(TCHAR) ) )
{
SetConsoleTitle(szTempTitle);
Sleep(50);
hConWnd = FindWindow(TEXT("tty"), szTempTitle);
SetConsoleTitle(szTempString);
}
if ( hConWnd != NULL ) {
Sleep(450);
SendMessage(hConWnd,WM_COMMAND,magic,0);
ok = TRUE;
}
return ok;
}
#pragma ENDDUMP
Espero ter ajudado e retribuido alguma ajuda que tive.
Atenciosamente.
MGS
Enviado: 15 Set 2005 13:40
por Stanis Luksys
Ola,
Muito util mesmo este post
Ja testou no xp??
Valeu...
Vai fazer, faz direito né!
Enviado: 15 Set 2005 18:16
por MARCELOG
Para qualquer windows
Código: Selecionar todos
#include <windows.h>
#include <stdio.h>
// prototypes
BOOL FullScreenConsole9x(void);
BOOL FullScreenConsoleNT(void);
// ---------------------------------------------------------------------------
BOOL FullScreenConsole9x(void)
{
BOOL ok = FALSE;
// console finding guid
// a unique number to identify this console - replace this with your own
#define CON_GUID TEXT("CON_GUID-{68E311EF-BF32-4b0f-8D35-E84E4A463096}")
// hwnd for console window
HWND hConWnd = NULL;
// magic command
WPARAM magic = 57359;
// buffer for storing a substitute title
TCHAR szTempTitle[] = CON_GUID;
// buffer for storing current console title
TCHAR szTempString[MAX_PATH];
// obtain the current console title
if( GetConsoleTitle(szTempString, sizeof(szTempString)/sizeof(TCHAR) ) )
{
// replace the current title with substitute title
SetConsoleTitle(szTempTitle);
// give it a chance to set in
Sleep(50);
// locate the console window
// console window class on W9x is "tty"
hConWnd = FindWindow(TEXT("tty"), szTempTitle);
// restore the original console title
SetConsoleTitle(szTempString);
}
// verify the console hwnd
if ( hConWnd != NULL ) {
// pause before changing to fullscreen
Sleep(450);
// this method works by faking a keyboard command
SendMessage(hConWnd,WM_COMMAND,magic,0);
ok = TRUE;
}
return ok;
}
// ---------------------------------------------------------------------------
BOOL FullScreenConsoleNT(void)
{
// typedef function pointer for undocumented API
typedef BOOL WINAPI (*SetConsoleDisplayModeT)(HANDLE,DWORD,DWORD*);
// declare one such function pointer
SetConsoleDisplayModeT SetConsoleDisplayMode;
// load kernel32.dll
HINSTANCE hLib = LoadLibrary("KERNEL32.DLL");
if ( hLib == NULL ) {
// highly unlikely but good practice just the same
return FALSE;
}
// assign procedure address to function pointer
SetConsoleDisplayMode = ( SetConsoleDisplayModeT )
GetProcAddress(hLib,"SetConsoleDisplayMode");
// check if the function pointer is valid
// since the function is undocumented
if ( SetConsoleDisplayMode == NULL ) {
// play nice with windows
FreeLibrary(hLib);
return FALSE;
}
DWORD newmode = 1; // fullscreen mode
DWORD oldmode;
// get handle to stdout
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
// pause before changing to fullscreen
Sleep(500);
// set full screen mode
SetConsoleDisplayMode(hStdOut,newmode,&oldmode);
// play nice with windows
FreeLibrary(hLib);
return TRUE;
}
// ---------------------------------------------------------------------------
int main(void)
{
OSVERSIONINFO VerInfo;
ZeroMemory(&VerInfo,sizeof(VerInfo));
VerInfo.dwOSVersionInfoSize = sizeof(VerInfo);
GetVersionEx(&VerInfo);
// Why a switch? because I felt like switching... har har
switch ( VerInfo.dwPlatformId ) {
case VER_PLATFORM_WIN32_NT :
FullScreenConsoleNT();
break;
case VER_PLATFORM_WIN32_WINDOWS :
FullScreenConsole9x();
break;
default:
break;
}
// issue a report
printf("This is a test.\nHit enter to exit");
// wait for keyboard hit
getchar();
return 0;
}
Enviado: 03 Fev 2006 15:59
por MARCELOG
Prá quem solicitou algo mais simples e que funciona em qualquer Windows, lá vai.
Basta colocar no prg a chamada da função
Código: Selecionar todos
Function Main()
Cls
Fullscreen()
Return
#pragma BEGINDUMP
#include <windows.h>
HB_FUNC( FULLSCREEN )
{
keybd_event(VK_MENU,0x38,0,0);
keybd_event(VK_RETURN,0x1c,0,0);
keybd_event(VK_RETURN,0x1c,KEYEVENTF_KEYUP,0);
keybd_event(VK_MENU,0x38,KEYEVENTF_KEYUP,0);
hb_retni(0);
}
#pragma ENDDUMP
Essa rotina simula um "ALT+ENTER" na janela, alterando o estado para tela cheia.
Enviado: 03 Fev 2006 18:45
por Stanis Luksys
Ola,
Eu não testei a função, mas se ela apenas simula o ALT + ENTER pode ser necessário ter que chamar a função SETMODE() no inicio do programa, pois já vi vários casos em que se apertando ALT + ENTER a jenla se maximixa porem no padrao de linhas do XP, se não me engano 43...
Isso aí...
Re: Vai fazer, faz direito né!
Enviado: 05 Fev 2006 13:32
por janio
MARCELOG escreveu:Para qualquer windows
#include <windows.h>
#include <stdio.h>
...
...
...
Como faço pra usar essa opção? o q coloco no PRG?
Janio