Jump to content

Recommended Posts

Posted

Hi,

I've tried to resize window by width and heigh, but its not working properly...

Hotkeys :

SHIFT + PageUp

SHIFT + PageDown

#include <IsPressed_UDF.au3>


While 1
    Sleep(100)
    If _IsPressed('10') Then
        If _IsPressed('21') Then _Resize('-', 30)
        If _IsPressed('22') Then _Resize('+', 30)
    EndIf
WEnd

Func _Resize($resize, $size)
    If $resize = '-' Then
        $gawi = _GetActiveWindowInfo()
        WinMove($gawi[1], '', $gawi[2], $gawi[3], $gawi[4] - $size, $gawi[5] - $size)
    ElseIf $resize = '+' Then
        $gawi = _GetActiveWindowInfo()
        WinMove($gawi[1], '', $gawi[2], $gawi[3], $gawi[4] + $size, $gawi[5] + $size)
    EndIf
EndFunc   ;==>_Resize

; #FUNCTION# ===================================================================
; Name :             _GetActiveWindowInfo
; Description:      Get Active Window Infos
; Return Value(s):  On Success - Returns $ret[1] to $ret[5]
;                   On Failure - Returns error
; Author(s):        FireFox
;===============================================================================
Func _GetActiveWindowInfo()
    Local $ret[10]
    $ret[1] = WinGetHandle(WinGetTitle('[ACTIVE]'))
    $wgp = WinGetPos($ret[1])
    $ret[2] = $wgp[0]
    $ret[3] = $wgp[1]
    $wgc = WinGetClientSize($ret[1])
    $ret[4] = $wgc[0]
    $ret[5] = $wgc[1]
    Return $ret
EndFunc   ;==>_GetActiveWindowInfo

Cheers, FireFox.

Posted

HotKeySet('{ESC}', '_EXIT')
Run('Notepad.exe')
WinWaitActive('Untitled -')
$hDll = DllOpen('user32.dll')
$GAKS = 'GetAsyncKeyState'

While 1
    $lshift = DllCall($hDll, 'short', $GAKS, 'int', 0xA0)
    $rshift = DllCall($hDll, 'short', $GAKS, 'int', 0xA1)
    $shiftf = BitOR(BitAND($lshift[0],0x8000), BitAND($rshift[0],0x8000))
    
    If $shiftf Then
        $Pageup = DllCall($hDll, 'short', $GAKS, 'int', 0x21)
        $PageDown = DllCall($hDll, 'short', $GAKS, 'int', 0x22)
        
            If BitAND($Pageup[0], 0x8001) Then
                _Resize(30)
            Else
                If BitAND($PageDown[0], 0x8001) Then _Resize(-30)
            EndIf
    EndIf
    
    Sleep(20)
WEnd

Func _Resize($size)
    Local $gawi, $i
    $gawi = _GetActiveWindowInfo()
    WinMove($gawi[1], '', $gawi[2], $gawi[3], $gawi[4]+$size, $gawi[5]+$size)
EndFunc   ;==>_Resize

; #FUNCTION# ===================================================================
; Name :             _GetActiveWindowInfo
; Description:      Get Active Window Infos
; Return Value(s):  On Success - Returns $ret[1] to $ret[5]
;                   On Failure - Returns error
; Author(s):        FireFox
;===============================================================================
Func _GetActiveWindowInfo()
    Local $ret[10], $i
    $ret[1] = WinGetHandle(WinGetTitle('[ACTIVE]'))
    $wgp = WinGetPos($ret[1])
    $ret[2] = $wgp[0]
    $ret[3] = $wgp[1]
    $ret[4] = $wgp[2]
    $ret[5] = $wgp[3]
    ConsoleWrite('Width = ' & $ret[4] & @TAB & 'Height = ' & $ret[5] & @CRLF)
    Return $ret
EndFunc   ;==>_GetActiveWindowInfo

Func _EXIT()
    Exit
EndFunc

Func OnAutoItExit()
    DllClose($hDll)
EndFunc

Quite messy (yeah messy, Barca...)

  • Moderators
Posted

FireFox,

Better refresh your memory on the return values from WinGetPos and the parameters of WinMove, mon ami!

#include <Misc.au3>

GUICreate("Test",100,100)
GUISetState()

$dll = DllOpen("user32.dll")

While 1
    If GUIGetMsg() = -3 Then Exit
    
    If _IsPressed('10') Then
        If _IsPressed('21') Then _Resize('+', 30)
        If _IsPressed('22') Then _Resize('-', 30)
    EndIf
WEnd

Func _Resize($resize, $size)
    $hWnd = WinGetHandle(WinGetTitle('[ACTIVE]'))
    $gawi = WinGetPos($hWnd)
    If $resize = '-' Then
        WinMove($hWnd, '', $gawi[0] + $size/2, $gawi[1] + $size/2, $gawi[2] - $size, $gawi[3] - $size)
    ElseIf $resize = '+' Then
        WinMove($hWnd, '', $gawi[0] - $size/2, $gawi[1] - $size/2, $gawi[2] + $size, $gawi[3] + $size)
    EndIf
EndFunc  ;==>_Resize

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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
×
×
  • Create New...