Jump to content

Recommended Posts

Posted (edited)

Hi all,

Is there a method to disable displaying the content of window while i am draging resizing it?

And i mean onle for my App, not for all (from the «Display Options»).

I guesing that this will involve some API-Calls, but where to start?

I know that there is one nice command to make dragable gui by any place:

  Quote

DllCall("user32.dll","long","SendMessage","hwnd",$HWnd,"int",$WM_SYSCOMMAND,"int",0xF009,"int",0)

But what is the message (if there is any at all) to resize and display only the edges of the window (using GuiRegistrMsg with WM_SIZING)?

Thanks.

Edited by MsCreatoR

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

  Quote

$GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESIZED

Please, read my post first :)

Thanks for replying.

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

  Quote
Oh, if i could understand C/C++ functions/syntax, then propably i was a really happy man :)

But thanks anyway, it's a start...

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

I worked it out! W00t! I'm proud of myself :)

#include <GUIConstants.au3>
Global Const $WM_ENTERSIZEMOVE = 0x231
Opt("GUICoordMode", 2)
Opt("GUIResizeMode", 1)
Opt("GUIOnEventMode", 1)

GUICreate("GUI", 200, 400, -1, -1, $WS_SIZEBOX)
GUIRegisterMsg ($WM_ENTERSIZEMOVE, "_Resize")
;GUISetOnEvent($WM_ENTERSIZEMOVE, "_Resize")
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

GUISetState(@SW_SHOW)
While 1
    Sleep(10)
WEnd

Func _Resize()
    ToolTip("Resizing Started", 0, 0)
EndFunc  ;==>_Resize

Func _Exit()
    Exit
EndFunc  ;==>_Exit
Posted

  Bert said:

I worked it out! W00t! I'm proud of myself :)

#include <GUIConstants.au3>
Global Const $WM_ENTERSIZEMOVE = 0x231
Opt("GUICoordMode", 2)
Opt("GUIResizeMode", 1)
Opt("GUIOnEventMode", 1)

GUICreate("GUI", 200, 400, -1, -1, $WS_SIZEBOX)
GUIRegisterMsg ($WM_ENTERSIZEMOVE, "_Resize")
;GUISetOnEvent($WM_ENTERSIZEMOVE, "_Resize")
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

GUISetState(@SW_SHOW)
While 1
    Sleep(10)
WEnd

Func _Resize()
    ToolTip("Resizing Started", 0, 0)
EndFunc ;==>_Resize

Func _Exit()
    Exit
EndFunc ;==>_Exit

Adding to that a bit, the code below hides the contents of the window while it's being resized. (Hope I understood what was wanted.)

#include <GUIConstants.au3>
Global Const $WM_ENTERSIZEMOVE = 0x231,$WM_EXITSIZEMOVE = 0x232
Global $child = 0
Opt("GUICoordMode", 2)
Opt("GUIResizeMode", 1)
Opt("GUIOnEventMode", 1)

$parent = GUICreate("GUI", 200, 400, -1, -1, $WS_SIZEBOX)
GUIRegisterMsg ($WM_ENTERSIZEMOVE, "_Resize")
GUIRegisterMsg ($WM_EXITSIZEMOVE, "_Downsize")
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
GUICtrlCreateButton("a button",50,100,100,21)
GUIRegisterMsg($WM_PAINT,"_Newsize")
GUISetState(@SW_SHOW)
While 1
    Sleep(10)
WEnd

Func _Resize()
    $wp = WinGetPos($parent)
    $cp = WinGetClientSize($parent)
    $border = ($wp[2] - $cp[0])/2
    $TitleHt = $wp[3] - $cp[1] - $border
    If $child = 0 Then
        $child = GUICreate("",$cp[0],$cp[1],$wp[0] + $border,$wp[1] + $TitleHt,$WS_POPUP,$WS_EX_TOPMOST)
        GUISetState(@SW_SHOW,$child)
        ToolTip("Resizing Started", 0, 0)
    Else
        WinMove($child,'',$wp[0] + $border,$wp[1] + $TitleHt,$cp[0],$cp[1])
    EndIf

EndFunc ;==>_Resize

Func _Downsize()
    ToolTip("")
    GUIDelete($child)
    $child = 0
EndFunc

Func _Newsize()
    If $child = 0 Then Return $GUI_RUNDEFMSG
    $wp = WinGetPos($parent)
    $cp = WinGetClientSize($parent)
    $border = ($wp[2] - $cp[0])/2
    $TitleHt = $wp[3] - $cp[1] - $border
    
    WinMove($child,'',$wp[0] + $border,$wp[1] + $TitleHt,$cp[0],$cp[1])
    
EndFunc


Func _Exit()
    Exit
EndFunc ;==>_Exit
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Posted
  Bert said:

Thanks martin. I figured OP could do it, because he is a very smart guy :)

Yes you're right, I just couldn't resist having a go.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Posted

Thanks guys, but i need something like this:

#include <GUIConstants.au3>

Global Const $WM_ENTERSIZEMOVE = 0x231
Opt("GUIOnEventMode", 1)

$parent = GUICreate("GUI", 200, 400, -1, -1, $WS_SIZEBOX)
GUIRegisterMsg($WM_ENTERSIZEMOVE, "WM_ENTERSIZEMOVE")
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
$Button = GUICtrlCreateButton("Button",50,100,100,21)

GUISetState(@SW_SHOW)

While 1
    Sleep(10)
WEnd

Func WM_ENTERSIZEMOVE()
   GUISetState(@SW_LOCK)
EndFunc ;==>_Resize

Func _Exit()
    Exit
EndFunc ;==>_ExitoÝ÷ Ù*-ç(×§¶íì"Ú0Â)e[yج¦V²yÖî·bêÞ²,â§yçm«mçë(§v.Â)emïîv+)¬u³Òý¶æj»böÁMf(¹Æ§'^¶¢{k¢[0)^­ë"Î)à)¶¬jëh×6#include <GUIConstants.au3>
#include <Constants.au3>

Global Const $WM_ENTERSIZEMOVE = 0x231, $WM_EXITSIZEMOVE = 0x232
Opt("GUICoordMode", 2)
Opt("GUIOnEventMode", 1)

$parent = GUICreate("GUI", 200, 400, -1, -1, $WS_SIZEBOX)
GUIRegisterMsg($WM_ENTERSIZEMOVE, "WM_ENTERSIZEMOVE")
GUIRegisterMsg($WM_EXITSIZEMOVE, "WM_EXITSIZEMOVE")
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
$Button = GUICtrlCreateButton("Button",50,100,100,21)

GUISetState(@SW_SHOW)

While 1
    Sleep(10)
WEnd

Func WM_ENTERSIZEMOVE()
    For $i = 3 To $Button
        GUICtrlSetState($i, $GUI_HIDE)
    Next
EndFunc ;==>_Resize

Func WM_EXITSIZEMOVE()
    For $i = 3 To $Button
        GUICtrlSetState($i, $GUI_SHOW)
    Next
EndFunc

Func _Exit()
    Exit
EndFunc ;==>_Exit

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

I found solution(?) here, but i can't get it work...

  ' said:

Why not set the redraw flag on the dialog and all of its children to FALSE (SendMessage(hwnd, WM_SETREDRAW, TRUE or FALSE, 0));

I am trying like this:

#include <GUIConstants.au3>
#include <Misc.au3>
Opt("GUIOnEventMode", 1)

Global Const $WM_ENTERSIZEMOVE = 0x231
Global Const $WM_EXITSIZEMOVE = 0x232
Global Const $WM_SETREDRAW = 0x000B

$parent = GUICreate("GUI", 200, 400, -1, -1, $WS_SIZEBOX)
GUIRegisterMsg($WM_ENTERSIZEMOVE, "WM_ENTERSIZEMOVE")
GUIRegisterMsg($WM_EXITSIZEMOVE, "WM_EXITSIZEMOVE")

GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

$Button = GUICtrlCreateButton("Button",50,100,100,21)

GUISetState(@SW_SHOW)

While 1
    Sleep(10)
WEnd

Func WM_ENTERSIZEMOVE()
    _SendMessage($parent, $WM_SETREDRAW, False, 0)
EndFunc

Func WM_EXITSIZEMOVE()
    _SendMessage($parent, $WM_SETREDRAW, True, 0)
EndFunc

Func _Exit()
    Exit
EndFunc ;==>_Exit

But the window is freezing while i am resizing it :)...

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

From Microsoft Website:

  Quote

An application sends the WM_SETREDRAW message to a window to allow changes in that window to be redrawn or to prevent changes in that window from being redrawn.

Well if you can't redraw the window, then it will freeze? I think maybe you need to have another solution... So let me get this straight, you want to hide the window contents when resizing?

Posted

  Quote

you want to hide the window contents when resizing?

No, i need that the window will not resized until i release the mose... but, while resizing i want to display the edges of the window...

Just run this example, and then resize the GUI window, you will see that the edges are drawned, but the content not displayed...

#include <GUIConstants.au3>

$OldParam = ToggleDragFullWindows(0)

GUICreate("Test", 400, 200, -1, -1, $WS_OVERLAPPEDWINDOW)

GUICtrlCreateLabel("Now try to resize the window ;)", 70, 70, 300, 40)
GUICtrlSetFont(-1, 14, 800)

GUISetState()

While GUIGetMsg() <> -3
WEnd

ToggleDragFullWindows($OldParam)

Func ToggleDragFullWindows($SetParam=-1)
    Local $OldParam = RegRead("HKEY_CURRENT_USER\Control Panel\Desktop", "DragFullWindows")
    
    If $SetParam = -1 Then
        $SetParam = 0
        If $OldParam <> 1 Then $SetParam = 1
    EndIf
    
    RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "DragFullWindows", "REG_SZ", $SetParam)
    DllCall("user32.dll", "int", "SystemParametersInfo", "int", 0x0025, "int", $SetParam, "int", 0, "int", 0)
    Return $OldParam
EndFunc

I need the same, but when "Show window contents while resizing/draging" is enabled (from performance options).

BTW: The function ToggleDragFullWindows() i wrote specialy to show this example ;) (i just do not know better way to explain what i need :) ).

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted (edited)

WM_SETREDRAW doesn't do anything you hadn't achieved before with GUISetState(@SW_LOCK).

You still have to draw the outline rectangle by yourself - catch WM_WINDOWPOSCHANGING or WM_SIZING+WM_MOVING to get current coordinates during the drag, and draw some look-alike on screen with LineTo() or Rectangle().

Or you can do like this to toggle that system mode during your drag:

#include <GUIConstants.au3>
#include <Misc.au3>
Opt("GUIOnEventMode", 1)

;~ Global Const $WM_ENTERSIZEMOVE = 0x231
Global Const $WM_EXITSIZEMOVE = 0x232
;~ Global Const $WM_SETREDRAW = 0x000B

Const $WM_SYSCOMMAND = 0x0112
Const $SC_MOVE = 0xF010
Const $SC_SIZE = 0xF000

Global $OldParam

$parent = GUICreate("GUI", 200, 400, -1, -1, $WS_SIZEBOX)
;~ GUIRegisterMsg($WM_ENTERSIZEMOVE, "WM_ENTERSIZEMOVE")
GUIRegisterMsg($WM_EXITSIZEMOVE, "WM_EXITSIZEMOVE")
GUIRegisterMsg($WM_SYSCOMMAND, "On_WM_SYSCOMMAND")


GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

$Button = GUICtrlCreateButton("Button",50,100,100,21)

GUISetState(@SW_SHOW)


While 1
    Sleep(100)
WEnd

Func On_WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam)
    Switch BitAND($wParam, 0xFFF0)
        Case $SC_MOVE, $SC_SIZE
            ;Const $SPI_SETDRAGFULLWINDOWS = 37
            ;Const $SPI_GETDRAGFULLWINDOWS = 38
            ;Const SPIF_SENDWININICHANGE = 2
            $tBool = DllStructCreate("int")
            DllCall("user32.dll", "int", "SystemParametersInfo", "int", 38, "int", 0, "ptr", DllStructGetPtr($tBool), "int", 0)
            $OldParam = DllStructGetData($tBool, 1)
            DllCall("user32.dll", "int", "SystemParametersInfo", "int", 37, "int", 0, "ptr", 0, "int", 2)
    EndSwitch
EndFunc
    
Func WM_EXITSIZEMOVE()
    DllCall("user32.dll", "int", "SystemParametersInfo", "int", 37, "int", $OldParam, "ptr", 0, "int", 2)
EndFunc

Func _Exit()
    Exit
EndFunc ;==>_Exit
Edited by Siao

"be smart, drink your wine"

Posted

Siao

  Quote

Or you can do like this to toggle that system mode during your drag

Gineus! Thanks again for you help, thats what i needed!!! :)

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

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