Jump to content

Granon

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by Granon

  1. #include <WinAPI.au3> #include <Constants.au3> #include <WindowsConstants.au3> #include <SendMessage.au3> Func DoThing($handle,$nx,$ny,$nw,$nh) $pos = WinGetPos($handle) $x = $pos[0] $y = $pos[1] $w = $pos[2] $h = $pos[3] $WM_ENTERSIZEMOVE = 0x0231 $WM_EXITSIZEMOVE = 0x0232 if $nx <> $x or $ny <> $y Then WinMove($handle,"",$nx,$ny) EndIf if $nw <> $w Then $lpRect = DllStructCreate("int;int;int;int") ; LEFT, TOP, RIGHT, BOTTOM $WMSZ_BOTTOMRIGHT = 8 DllStructSetData($lpRect,1,$nx) DllStructSetData($lpRect,2,$ny) DllStructSetData($lpRect,3,$nx + $nw) DllStructSetData($lpRect,4,$ny + $nh) _SendMessage($handle,$WM_ENTERSIZEMOVE) _SendMessage($handle,$WM_SIZING,$WMSZ_BOTTOMRIGHT,DllStructGetPtr($lpRect)) $nw = DllStructGetData($lpRect,3) - DllStructGetData($lpRect,1) $nh = DllStructGetData($lpRect,4) - DllStructGetData($lpRect,2) _WinAPI_SetWindowPos($handle,0,0,0,$nw,$nh,$SWP_NOMOVE) _SendMessage($handle,$WM_EXITSIZEMOVE) EndIf EndFunc It's complicated, if putty receives a "WM_SIZE" message when it hasn't received a "WM_ENTERSIZEMOVE" message it will (as you've found out) return to it's original size. To maintain the size stepped to rows and columns of the terminal, you have to give it a chance to do so Send a WM_ENTERSIZEMOVECreate a structure lpRect, fill it, send it with a WM_SIZINGread the returned values from the structureresize according to thosethen finally send a WM_EXITSIZEMOVE. Hope this helps.
×
×
  • Create New...