Jump to content

Force another application in windowed fullscreen mode.


gigi1
 Share

Recommended Posts

Hi,

i'm trying to make an application to transform existing windows into "windowed fullscreen".

For example, i want to achieve with other applications what can be done in autoit with this code:

GUICreate("asd", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
GUISetState()
Sleep(3000)

So far i've searched the forums and found the _WinApi_SetWindowLong() function, but if i do this:

$hwnd = WinGetHandle("[Class:Notepad]")
WinMove($hwnd, "", 0, 0, @DesktopWidth, @DesktopHeight)
_WinAPI_SetWindowLong($hwnd, $GWL_STYLE, $WS_POPUP)

then weird things will happen: Notepad will go in windowed fullscreen mode, but the taskbar will still be there, and the whole notepad window will be inactive. Moreover if you click somewhere in the notepad window the click will go below it (ex.: it will launch desktop applications if you happen to click where their icon is).

Any ideas on how to do it?

Thanks

Link to comment
Share on other sites

okay so i tested it and came up with this:

(assuming notepad is running)

#include <Constants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

$width = @DesktopWidth
$height = @DesktopHeight
$hWnd = WinGetHandle("[CLASS:Notepad]")
If @error Then MsgBox(0, "error", "error")
$iStyle = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE)
$iStyle = BitOR($iStyle, $WS_POPUP)
_WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $iStyle)
_WinAPI_SetWindowPos($hWnd, $HWND_TOP, 0, 0, $width, $height, $SWP_FRAMECHANGED)

However, this doesn't change the window style at all.

Moreover, it will not place the window on top of the taskbar like the $WS_POPUP does for native autoit GUIs. (i know i could do it using the flag $HWND_TOPMOST instead of HWND_TOP, but then it's not possible to alt-tab to other applications).

edit: change from code to autoit code, didn't see it in the first place. code highlighting is nice :)

Edited by gigi1
Link to comment
Share on other sites

#include <Constants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Local Const $hWnd = WinGetHandle("[CLASS:Notepad]")
If @error Then MsgBox(0, "error", "error")

Local $iStyle = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE)

$iStyle = BitOR(BitXOR($iStyle, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_CAPTION, $WS_BORDER, $WS_SIZEBOX), $WS_POPUP)

_WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $iStyle)
_WinAPI_SetWindowPos($hWnd, $HWND_TOPMOST, 0, 0, @DesktopWidth, @DesktopHeight, $SWP_FRAMECHANGED)

Link to comment
Share on other sites

thanks again, so simple, i feel so nab >_<

but... its not working for many applications, too, (example: windows media player) :(

I wanted to make my own window manager, but it seems that i won't be able to fullscreen a lot of applications, and many others just glitch on forced styles.

Edited by gigi1
Link to comment
Share on other sites

it seems that i won't be able to fullscreen a lot of applications, and many others just glitch on forced styles.

You can, make a list of "non-wanted" styles and remove them only if they are present.
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...