Jump to content

Recommended Posts

Posted

Hi. How to crop a window so that there is no frame (after crop) and title window?

#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

 

win_example.jpg

Posted
_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).

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
  • Recently Browsing   0 members

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