Hi,

What is the efficient way to toggle an application FullScreen or windowed?

What is the faster way ? the smaller way ?

Thanks a lot.
Posted on 2002-06-04 17:01:02 by DarkEmpire
Do you want to show it in Fullscreen or Maximize it?
For maximiz?ng, something like


invoke SendMessage, hWnd, WM_MAXIMIZE, 0, 0


will work. For Fullscreen, get the Desktop resolution with



invoke GetSystemMetrics, SM_CXSCREEN
mov nX, eax
invoke GetSystemMetrics, SM_CYSCREEN
mov nY, eax


And do a MoveWindow to reseize it.
Posted on 2002-06-05 00:51:30 by bazik
Thanks a lot. :alright:

But is it possible de change the window style without creating a new window ?
Posted on 2002-06-05 05:30:05 by DarkEmpire
Sure. Just use GetWindowLong / SetWindowLong with GWL_EXSTYLE or GWL_STYLE flag. Here is a example from my Outlookbar:


MouseOver proc hCtl :DWORD
invoke GetWindowLong, hCtl, GWL_EXSTYLE ; get extended style
.if (!(eax & WS_EX_CLIENTEDGE)) ; if WS_EX_CLIENTEDGE is not set (this check prevents flickering) ----+
push edi
mov edi, eax ; |
mov eax, WS_EX_CLIENTEDGE ; |
or eax, edi ; |
invoke SetWindowLong, hCtl, GWL_EXSTYLE, eax ; set it <-------------------------------------------|
invoke SetWindowPos, hCtl, 0, 0, 0, 0, 0, ; redraw window
SWP_NOSIZE or SWP_NOMOVE or \
SWP_NOZORDER or SWP_NOACTIVATE or \
SWP_FRAMECHANGED
pop edi
.endif
ret
MouseOver endp

MouseOut proc hCtl :DWORD
invoke GetWindowLong, hCtl, GWL_EXSTYLE ; get extended style
.if (eax & WS_EX_CLIENTEDGE) ; check if style is set (prevents flickering, too)
and eax, not WS_EX_CLIENTEDGE ; if yes, then remove it
invoke SetWindowLong, hCtl, GWL_EXSTYLE, eax ; store it
invoke SetWindowPos, hCtl, 0, 0, 0, 0, 0, ; redraw window
SWP_NOSIZE or SWP_NOMOVE or \
SWP_NOZORDER or SWP_NOACTIVATE or \
SWP_FRAMECHANGED
.endif
ret
MouseOut endp
Posted on 2002-06-05 05:45:01 by bazik
Thanks but here is the problem:

i create a window (background = black)(WS_OVERLAPPEDWINDOW), then i toggle FullScreen (using your method: SetWindowLong and MoveWindow)

But when i switch to windowed mode from FullScreen mode, the window is ok, but the background of my screen keep the black coulor...

What is the problem ?
Posted on 2002-06-05 06:47:34 by DarkEmpire
Hmm... sounds like a repaint problem. Had a similar one and the reason was the "hbrBackground" part of the WNDCLASSEX structure.
Can you please post your source?
Posted on 2002-06-05 07:34:43 by bazik
Thanks a lot for your help, and for the time you spend to help me...

I found the solution of the problem...

Instead of using MoveWindow, i had to use SetWindowPos...

And all works.

Thanks a lot again
Posted on 2002-06-05 15:00:54 by DarkEmpire