Jump to content

Funcao em C - Ecran


Recommended Posts

Posted

Este código permite-te por a janela em ecrã inteiro, não é bem o queres mas poderá dar-te jeito:

#include <stdio.h>
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0502
#endif
#include <windows.h>
#define FULL_SCREEN TRUE
#define WINDOWED FALSE
BOOL setScreenMode( BOOL b )
{
COORD coord;
BOOL success = 0;

HANDLE hConsole = GetStdHandle( STD_OUTPUT_HANDLE );
if(hConsole == NULL || hConsole == INVALID_HANDLE_VALUE )
return success;

if(b)
success = SetConsoleDisplayMode( hConsole, CONSOLE_FULLSCREEN_MODE, &coord);
else
success = SetConsoleDisplayMode( hConsole, CONSOLE_WINDOWED_MODE, &coord);

return success;
}
int main()
{
   BOOL mode;
   mode = setScreenMode( FULL_SCREEN );
   if(mode)
   printf("Modo FullScreen");
   else
   printf("Falha no modo de FullScreen");

   getchar();

   mode = setScreenMode( WINDOWED );
   if(mode)
           printf("Modo Janela");
   else
       printf("Falha no modo de Janela");

   getchar();
   return 0;
}
Posted

dá um erro com esse código,

SOL_WORK.c In function `setScreenMode':

  (Each undeclared identifier is reported only once SOL_WORK.c `CONSOLE_FULLSCREEN_MODE' undeclared (first use in this function)

SOL_WORK.c `CONSOLE_WINDOWED_MODE' undeclared (first use in this function) 

@Pedro Lopes

Posted

Dá erro, comigo compilou e correu na boa, e também estou a utilizar o Dev-C++. Disses-te ali encima que também não conseguiste compilar o código do link que o TheDark te deu, poderás ter um problema no Dev-C++, tenta reinstala-lo.

Posted

o meu era mesmo em C, talvez sejam versões diferentes do Dev-C++. Já aconteceu em casa poder utilizar certas função incluindo só o stdio.h e na escola tenho mesmo de incluir o string.h o stdlib.h e assim. Não sei exactamente porquê. Mas tirei aquele código da net á uns tempos, entre tanto já o modifiquei.

Posted

Experimenta assim:

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

dreams.each do |dream|

   dream.make_it_happen

end

Posted

Então formulaste mal a pergunta. O que querias era colocar a consola em ecrã inteiro. Para isso utiliza-se a função SetConsoleDisplayMode, como está no código do Peterv5. O código do SONIC_ é um hack algo feio 🙂

Desaparecido.

Posted

(...) O código do SONIC_ é um hack algo feio 🙂

Foi um amigo meu que encontrou, e a partir dai comecei a usar quando precisava e nem me lembrei de ver ser havia outra forma de o fazer.  😄

dreams.each do |dream|

   dream.make_it_happen

end

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.