SEKOMD Posted November 7, 2024 Posted November 7, 2024 Hi. How to crop a window so that there is no frame (after crop) and title window? expandcollapse popup#include <ScreenCapture.au3> #include <GDIPlus.au3> #include <WinAPIProc.au3> #include <SendMessage.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $hRegionInf, $hRegion, $hRGN, $hNotepad ;exit func HotKeySet('{ESC}', 'Terminate') Func Terminate() _WinAPI_DeleteObject($hRGN) _GDIPlus_RegionDispose($hRegion) _GDIPlus_RegionDispose($hRegionInf) _GDIPlus_Shutdown() WinClose($hNotepad) Exit EndFunc ;==>Terminate Run('notepad.exe') Sleep(700) $hNotepad = WinGetHandle('[ACTIVE]') WinSetTitle($hNotepad,'','MyNote') WinMove($hNotepad, '', 200, 200, 800, 600) _GDIPlus_Startup() $hRegionInf = _GDIPlus_RegionCreate() $iWidth = WinGetPos($hNotepad)[2] $hRegion = _GDIPlus_RegionCreateFromRect(0, 0, $iWidth, 120) _GDIPlus_RegionCombineRegion($hRegion, $hRegionInf, 3) $hRGN = _GDIPlus_RegionGetHRgn($hRegion, 0) _WinAPI_SetWindowRgn($hNotepad, $hRGN) ;_GDIPlus_RegionUpdate WinSetState($hNotepad,'',@SW_MINIMIZE) ;? WinSetState($hNotepad,'',@SW_RESTORE) While Sleep(100) WEnd
SEKOMD Posted November 7, 2024 Author Posted November 7, 2024 _WinAPI_SetWindowLong($hNotepad, $GWL_STYLE, 0x94000000) _WinAPI_SetWindowLong($hNotepad, $GWL_EXSTYLE, 0x00040000) _WinAPI_UpdateWindow($hNotepad) Solves the problem. However, strange white margins appear - on the right and at the bottom. Sorry for my English (Google translator).
AndrewG Posted November 8, 2024 Posted November 8, 2024 (edited) <snip> Edited November 8, 2024 by AndrewG
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now