AutoIt Forums: Ho to set resizing without displaying window content? - AutoIt Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Ho to set resizing without displaying window content? While resizing the content is displayed, i need to disable it

#1 User is offline   MrCreatoR 

  • Must AutoIt!
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 2,907
  • Joined: 05-February 07
  • Gender:Male
  • Location:IL

Post icon  Posted 12 October 2007 - 11:04 AM

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.

This post has been edited by MsCreatoR: 12 October 2007 - 11:05 AM


#2 User is offline   BrettF 

  • My Drunk Monkey Guerilla is gonna getcha!
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 7,644
  • Joined: 02-October 06
  • Gender:Male
  • Location:Brisbane, Australia

Posted 12 October 2007 - 11:32 AM

$GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESIZED

#3 User is offline   MrCreatoR 

  • Must AutoIt!
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 2,907
  • Joined: 05-February 07
  • Gender:Male
  • Location:IL

Posted 12 October 2007 - 11:55 AM

Quote

$GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESIZED

Please, read my post first ;)
Thanks for replying.

#4 User is offline   BrettF 

  • My Drunk Monkey Guerilla is gonna getcha!
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 7,644
  • Joined: 02-October 06
  • Gender:Male
  • Location:Brisbane, Australia

Posted 12 October 2007 - 12:01 PM

Ahhh... I see. You meant while you were resizing... Shows you how much I can read :P Sorry for not giving you an answer :)

#5 User is offline   Siao 

  • RTFM, foo!
  • PipPipPipPipPip
  • Group: Full Members
  • Posts: 937
  • Joined: 26-May 07
  • Location:Temple of Logic

Posted 12 October 2007 - 12:46 PM

Quote

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

M$ has an example - http://support.microsoft.com/kb/121541

#6 User is offline   MrCreatoR 

  • Must AutoIt!
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 2,907
  • Joined: 05-February 07
  • Gender:Male
  • Location:IL

Posted 12 October 2007 - 01:13 PM

Quote


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

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

#7 User is offline   BrettF 

  • My Drunk Monkey Guerilla is gonna getcha!
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 7,644
  • Joined: 02-October 06
  • Gender:Male
  • Location:Brisbane, Australia

Posted 12 October 2007 - 10:19 PM

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

[ code='text' ]    ( ExpandCollapse - Popup )
#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


#8 User is offline   martin 

  • ~~\o/~~~/0\=¬''~~~
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 6,445
  • Joined: 24-October 04
  • Location:uk

Posted 12 October 2007 - 11:41 PM

View PostBert, on Oct 12 2007, 10:19 PM, said:

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

[ code='text' ]    ( ExpandCollapse - Popup )
#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.)

[ code='text' ]    ( ExpandCollapse - Popup )
#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


#9 User is offline   BrettF 

  • My Drunk Monkey Guerilla is gonna getcha!
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 7,644
  • Joined: 02-October 06
  • Gender:Male
  • Location:Brisbane, Australia

Posted 13 October 2007 - 12:07 AM

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

#10 User is offline   martin 

  • ~~\o/~~~/0\=¬''~~~
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 6,445
  • Joined: 24-October 04
  • Location:uk

Posted 13 October 2007 - 01:28 AM

View PostBert, on Oct 13 2007, 12:07 AM, said:

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

Yes you're right, I just couldn't resist having a go.

#11 User is offline   BrettF 

  • My Drunk Monkey Guerilla is gonna getcha!
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 7,644
  • Joined: 02-October 06
  • Gender:Male
  • Location:Brisbane, Australia

Posted 13 October 2007 - 02:26 AM

Some fun for the time being... MMmmmm... Never really played with the wm messages before. Was a good learning curve :P

#12 User is offline   MrCreatoR 

  • Must AutoIt!
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 2,907
  • Joined: 05-February 07
  • Gender:Male
  • Location:IL

Posted 13 October 2007 - 08:41 PM

Thanks guys, but i need something like this:

[ autoIt ]    ( ExpandCollapse - Popup )
#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 ;==>_Exitƒo݊÷ Ù*-…ç(ž×§¶‡í…ì"Ú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


#13 User is offline   MrCreatoR 

  • Must AutoIt!
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 2,907
  • Joined: 05-February 07
  • Gender:Male
  • Location:IL

Posted 13 October 2007 - 11:27 PM

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

http://www.experts-exchange.com/Programming/System/Windows__Programming/Q_10037195.html#a1410453 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:

[ autoIt ]    ( ExpandCollapse - Popup )
#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 :(...

#14 User is offline   BrettF 

  • My Drunk Monkey Guerilla is gonna getcha!
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 7,644
  • Joined: 02-October 06
  • Gender:Male
  • Location:Brisbane, Australia

Posted 14 October 2007 - 12:13 AM

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?

#15 User is offline   MrCreatoR 

  • Must AutoIt!
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 2,907
  • Joined: 05-February 07
  • Gender:Male
  • Location:IL

Posted 14 October 2007 - 03:18 AM

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

[ autoIt ]    ( ExpandCollapse - Popup )
#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 :rolleyes: ).

#16 User is offline   Siao 

  • RTFM, foo!
  • PipPipPipPipPip
  • Group: Full Members
  • Posts: 937
  • Joined: 26-May 07
  • Location:Temple of Logic

Posted 14 October 2007 - 04:44 PM

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:
[ autoIt ]    ( ExpandCollapse - Popup )
#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

This post has been edited by Siao: 14 October 2007 - 04:47 PM


#17 User is offline   MrCreatoR 

  • Must AutoIt!
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 2,907
  • Joined: 05-February 07
  • Gender:Male
  • Location:IL

Posted 14 October 2007 - 08:40 PM

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!!! :cheer:

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users