Board index » cppbuilder » How to change Video Mode to Full Screen for displaying JPEG images

How to change Video Mode to Full Screen for displaying JPEG images

My program runs a slide show of JPEG images in a window (640x480).
I want to allow user to switch between 640x480 full screen mode and
back to the windows mode, similar to MS-MediaPlayer.
How can I do that?

BTW, thank you for all the helpful answers I got.

 

Re:How to change Video Mode to Full Screen for displaying JPEG images


DEVMODE lpDevCurrentMode;
DEVMODE lpDevNewMode;

  lpDevCurrentMode.dmSize = sizeof(DEVMODE);
  lpDevNewMode.dmSize     = sizeof(DEVMODE);
  ::EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &lpDevCurrentMode);
  memcpy(&lpDevNewMode, &lpDevCurrentMode, sizeof(DEVMODE));

  if (_argc > 1)
  {
    if (!stricmp("640", _argv[1]))
    {
      lpDevNewMode.dmPelsWidth  = 640;
      lpDevNewMode.dmPelsHeight = 480;
    }
    else if (!stricmp("1024", _argv[1]))
    {
    }
  }
  else
  {
    lpDevNewMode.dmPelsWidth  = XRES;
    lpDevNewMode.dmPelsHeight = YRES;
  }
  lpDevNewMode.dmBitsPerPel = 16;
  lpDevNewMode.dmFields     = DM_PELSWIDTH | DM_PELSHEIGHT;
  LONG result = ::ChangeDisplaySettings(&lpDevNewMode, CDS_TEST);
  if (result == DISP_CHANGE_SUCCESSFUL)
    ::ChangeDisplaySettings(&lpDevNewMode, 0);
  else if (result == DISP_CHANGE_RESTART)
    ShowMessage("Requires a reboot!");
  else
    ShowMessage("Setting unsupported.");

for return to the previous resolution
::ChangeDisplaySettings(&lpDevCurrentMode, 0);

Ciao

Re:How to change Video Mode to Full Screen for displaying JPEG images


Try using this,It works perfectly:

void __fastcall FullScreen(TForm *Form,TColor Color)
{
  Form->FormStyle=fsStayOnTop;
  Form->BorderStyle=bsNone;
  Form->Top=0;
  Form->Left=0;
  Form->Width=Screen->Width;
  Form->Height=Screen->Height;
  Form->Color=Color;

Quote
}

Other Threads