Jump to content

Change a window to its mirror image


Malkey
 Share

Recommended Posts

Instead of going off topic here. I came across a curious behavior when replacing $WS_EX_TRANSPARENT with -1.

Subsequently, a search of these forums did show the GUI exStyle $WS_EX_LAYOUTRTL has been demonstrated before.

On my xp this script makes any window (Notepad window used here) appear as its mirror image including the text.

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

Run("notepad.exe")
WinActivate("Untitled - Notepad")
WinWaitActive("Untitled - Notepad")
$hWnd = WinGetHandle("Untitled - Notepad")
WinMove("[CLASS:Notepad]", "", @DesktopWidth / 2 - 200, @DesktopHeight / 2 - 250, 400, 200)

Local $ExS = _WinAPI_GetWindowLong($hWnd, $GWL_EXSTYLE) ; Existing extended style of the window.

_WinAPI_SetWindowLong($hWnd, $GWL_EXSTYLE, BitOR($ExS, $WS_EX_LAYOUTRTL))
_WinAPI_InvalidateRect($hWnd)
Send("qwerty - 1234567890")
MsgBox(0, "", "Continue")

_WinAPI_SetWindowLong($hWnd, $GWL_EXSTYLE, BitOR($ExS, $WS_EX_COMPOSITED, $WS_EX_LAYOUTRTL))
_WinAPI_InvalidateRect($hWnd)
MsgBox(0, "", "Continue")

_WinAPI_SetWindowLong($hWnd, $GWL_EXSTYLE, $ExS) ; Back to original exStyle of the window.
_WinAPI_InvalidateRect($hWnd)

MsgBox(0, "", "End")
$PID = ProcessExists("notepad.exe")
If $PID Then ProcessClose($PID)
Link to comment
Share on other sites

Looks very interesting!

This works also on Vista x32 and Win7 x64!

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

$pid = Run("notepad.exe")
Sleep(750)
WinActivate("[CLASS:Notepad]", "")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
WinMove("[CLASS:Notepad]", "", @DesktopWidth / 2 - 200, @DesktopHeight / 2 - 250, 400, 200)

Local $ExS = _WinAPI_GetWindowLong($hWnd, $GWL_EXSTYLE) ; Existing extended style of the window.

_WinAPI_SetWindowLong($hWnd, $GWL_EXSTYLE, BitOR($ExS, $WS_EX_LAYOUTRTL))
_WinAPI_InvalidateRect($hWnd)
Send("qwerty - 1234567890")
MsgBox(0, "", "Continue")

_WinAPI_SetWindowLong($hWnd, $GWL_EXSTYLE, BitOR($ExS, $WS_EX_COMPOSITED, $WS_EX_LAYOUTRTL))
_WinAPI_InvalidateRect($hWnd)
MsgBox(0, "", "Continue")

_WinAPI_SetWindowLong($hWnd, $GWL_EXSTYLE, $ExS) ; Back to original exStyle of the window.
_WinAPI_InvalidateRect($hWnd)

MsgBox(0, "", "End")

ProcessClose($PID)

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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...