1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
void
FenetreSrv::SwitchFullScreen(void)
{
HWND hwnd = (HWND)getSystemView();
//Si la fenetre est maximisee on la reduit
::ShowWindow(hwnd, SW_RESTORE);
//on commence par cacher la fenetre
::ShowWindow(hwnd, SW_HIDE);
long style = ::GetWindowLong(hwnd, GWL_STYLE);
if(_fullScreen)
{
updatePanes(IlTrue);
//restaure le style par defaut
style &= ~WS_POPUP;
style |= WS_OVERLAPPEDWINDOW;
::SetWindowLong(hwnd,GWL_STYLE,style);
//restaure la position sauvegardee
::SetWindowPos(hwnd,
HWND_TOP,
_previousRect.left,
_previousRect.top,
_previousRect.right-_previousRect.left,
_previousRect.bottom-_previousRect.top,
SWP_FRAMECHANGED);
}
else
{
//sauve la taille actuelle.
::GetWindowRect(hwnd,&_previousRect);
//passe en style popup, et degage la barre de titre
style &= ~WS_OVERLAPPEDWINDOW;
style |= WS_POPUP;
// prise en compte du multi écran
//occupe la totalite de l'ecran courant (ou par defaut le 1er)
HMONITOR monitor;
monitor = MonitorFromWindow( hwnd, MONITOR_DEFAULTTOPRIMARY);
MONITORINFO monitorInfo;
monitorInfo.cbSize = sizeof(MONITORINFO); //obligatoire de fixer la valeur avant l'appel à GetMonitorInfo
::GetMonitorInfo(monitor, // handle to display monitor
&monitorInfo ); // display monitor information
int mx = monitorInfo.rcMonitor.left;
int my = monitorInfo.rcMonitor.top;
int mw = monitorInfo.rcMonitor.right;
int mh = monitorInfo.rcMonitor.bottom;
//ne pas employer le style topmost, qui va creer des problemes avec les boites de dialogue
//::SetWindowPos(hwnd,HWND_TOPMOST,0,0,mx,my,SWP_FRAMECHANGED);
::SetWindowPos(hwnd,HWND_TOP,mx,my,mw-mx,mh-my,SWP_ASYNCWINDOWPOS);
::SetWindowLong(hwnd,GWL_STYLE,style);
}
_fullScreen = !_fullScreen;
::ShowWindow(hwnd, SW_SHOW);
} |
Partager