Jump to content
Sign in to follow this  

Resizing Window Causes Whited Out Controls

Recommended Posts

So I'm making this gui with an embedded IE object. It all goes well until I add some functionality, one in particular and it's a big one, the window will be in the same place and same size as you left it when you last exited the program. No big deal until I found that when I resize the window programmatically the controls below the IE Object seemingly disappear. Look a little closer and I find that they're not invisible, just white. I messed around and found out that it has something to do with having the style $WS_CLIPCHILDREN on the gui. I take it off and the controls show up no problem, but then the whole IE object freezes so that's definitely not the solution I'm looking for. I've tried searching the forums, the internet, and the help file, but I can't find the answer to this evil problem. One thing I noticed was that if I resized the window just the slightest with the mouse all the controls would reappear, or if I hovered on them they parts of the control would reappear piece by piece. So I tried using some window redraw / repaint functions, I've tried several different winmove functions, and I even went so far as to try to emulate resizing the window through the mouse by using the _SendMessage function to send the individual WM_ENTERSIZEMOVE, WM_SIZING, WM_SIZE, and WM_EXITSIZEMOVE messages to the window, but to no avail. However if I set a certain size of window with the WM_SIZE message that wasn't the window size it would show up in the window with a bunch of whitespace because it wasn't taking up the whole window, but that isn't germane and I digress.

If anyone knows any rerendering messages I could send the the window please post them here! I'm willing to try anything at the moment. I assume there's a message I'm missing in the resizing emulation since it isn't coming out right.

Oh, another thing that would be helpful is if someone knew how to monitor all the messages going to my gui, instead of just specific individual messages defined by the GUIRegisterMsg function.

Below is a far shortened example of my code along with the screen shot of it with a few citations.

#include <IE.au3>
#include <Array.au3>
#include <WinAPI.au3>
#include <Constants.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$name = @UserName
$opts = " |Me ("&$name&")"
$oIE = _IECreateEmbedded()

$Main = GUICreate("Example of Frustration", 795, 610, 192, 124, BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX,$WS_THICKFRAME,$WS_CLIPCHILDREN))
$ObjectIE = GUICtrlCreateObj($oIE, 8, 8, 777, 561)
GUICtrlCreateLabel("Follow", 8, 580, 34, 17, $WS_CLIPSIBLINGS)
$ComboFollow = GUICtrlCreateCombo("", 48, 578, 145, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$WS_CLIPSIBLINGS))
$default = " "
GUICtrlSetData(-1, $opts, $default)
$SliderOpacity = GUICtrlCreateSlider(280, 576, 150, 25)
GUICtrlSetLimit(-1, 255, 55)
GUICtrlSetData(-1, 255)
$ButtonFullscreen = GUICtrlCreateButton("Faux Fullscreen", 680, 576, 107, 25, $WS_CLIPSIBLINGS)

_IENavigate($oIE, "http://google.com")

_WinAPI_MoveWindow($Main, 100, 100, 450, 350)

While 1
If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit

Posted Image

Thanks for your time!


Share this post

Link to post
Share on other sites

Although there might be a style that auto does that.


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post

Link to post
Share on other sites

That did it! (Sort of, see below)

Thank you so much PhoenixXL I searched all over but to no avail not having a clue what to search for.

You've made my day.

Jon: Yeah, I tried that but it didn't work, maybe it would have if I passed it the right combination of flags.

Thank you both for your help.

Although I would like furthur input.

When I add that style, I didn't notice at first, but the IE object starts to flicker really bad when I move the cursor over it, possibly due to heavy rendering process of the frame not being able to draw fast enough?

Is there a way for me to tell it to draw over the old image instead of setting all the pixels to background color and then drawing over that?

Edited by BAM5

Share this post

Link to post
Share on other sites

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
Sign in to follow this  

  • Similar Content

    • By nacerbaaziz
      hello sirs, i've created a tool to the blind users, this tool helps the blind to listen to a audio effect when moving between the GUIs controls on they computers
      where this tool can get the class for the current focus control and play a sound from a folder
      i've added all the knowne classes, but i found some problems i hope any one can help me.
      this is the code that i created

      #include <WinAPISys.au3> Global $h_CurrentHWNDFocus = "", $h_CurrentControlHWNDFocus = "" AdlibRegister("WindowAudioFocus", 50) Func WindowAudioFocus()     Local $h_NewHWNDFocus = WinGetHandle("[active]", "")     Local $h_NewControlHWNDFocus = ControlGetFocus($h_NewHWNDFocus, "")     If ($h_NewHWNDFocus = $h_CurrentHWNDFocus) And ($h_NewControlHWNDFocus = $h_CurrentControlHWNDFocus) Then Return 0     AdlibUnRegister("WindowAudioFocus")     If Not ($h_NewHWNDFocus = $h_CurrentHWNDFocus) Then         SoundPlay(@ScriptDir & "\focus_Audio\WindowChanged.wav")     Else         Switch _WinAPI_GetClassName(ControlGetHandle($h_NewHWNDFocus, "", $h_NewControlHWNDFocus))             Case "Button", "Start", "TrayButton", "TrayShowDesktopButtonWClass", "sbutton", "CirrussButton", "ODbcButton", "ThunderRTCommandButton", "ThunderSSOption", "ThunderSSCommand", "ThunderCommandButton", "ThunderRT6CommandButton", "ThunderRT5CommandButton", "TButton", "TBitBtn", "TAdvGlowButton", "ButtonWndClass", "afx:0:376:baa946", "_AOL_Button"                 If _IsCheckBox(ControlGetHandle($h_NewHWNDFocus, "", $h_NewControlHWNDFocus)) Then                     SoundPlay(@ScriptDir & "\focus_Audio\checkBox.wav")                 ElseIf _IsRadio(ControlGetHandle($h_NewHWNDFocus, "", $h_NewControlHWNDFocus)) Then                     SoundPlay(@ScriptDir & "\focus_Audio\radio.wav")                 Else                     SoundPlay(@ScriptDir & "\focus_Audio\button.wav")                 EndIf             Case "ComboBox", "ComboBoxEx32", "MSOBALLOONREComboBox20W", "REComboBox20W", "ThunderComboBox", "ThunderDriveListBox", "ThunderRT6ComboBox", "TORComboEdit", "TCombobox", "TComboBoxEx", "TORComboBox", "TColorBox", "TNFComboBox", "Internet Explorer_TridentCmbobx", "ComboWndClass", "_AOL_ComboBox", "ThunderRT5ComboBox", "ComboLBox"                 SoundPlay(@ScriptDir & "\focus_Audio\list.wav")             Case "Edit", "SearchBox", "TChatRichEdit", "_WwN", "_WwO", "RichEdit20A", "RichEdit20WPT", "RICHEDIT60W", "OKttbx", "RichEditA", "ThunderTextBox", "ThunderRT6TextBox", "ThunderRT5TextBox", "TEdit", "TRichEdit", "TRichEditViewer", "TMemo", "TInplaceEditList", "TLabeledEdit", "TMaskEdit", "TDateTimePicker", "TRichEdit", "TCaptionMemo", "TAddictRichEdit", "TCaptionEdit", "RichTextWndClass", "TextWndClass", "PasswordWndClass", "TextAreaWndClass", "MSWorksDoc", "_AOL_Edit", "SysDateTimePick32"                 SoundPlay(@ScriptDir & "\focus_Audio\edit.wav")             Case "ListBox", "ComboLBox", "REListBox20W", "SUPERGRID", "OUTEXVLB", "WMSUIVLB", "SchdmapiVLB", "VLBClass", "ThunderDirListBox", "ThunderFileListBox", "ThunderListBox", "ThunderRT6ListBox", "ThunderRT5ListBox", "TListbox", "TValueListEditor", "TORCalendar", "TColorListBox", "TCheckListBox", "Internet Explorer_TridentLstBox", "ListBoxWndClass", "ListWndClass", "hh_kwd_vlist", "afx:8:376:0:946", "_AOL_ListBox", "_AOL_Tree", ""                 SoundPlay(@ScriptDir & "\focus_Audio\List.wav")             Case "SysListView32", "OpenListView", "wuDuiListView", "ListView20WndClass", "TcxGridSite", "TListView", "TSystemListView", "ListViewWndClass", ""                 SoundPlay(@ScriptDir & "\focus_Audio\ListView.wav")             Case "SysTreeView32", "SearchTreeList", "FeatureTree", "TreeView20WndClass", "TSystemTreeView", "TTreeView", ""                 SoundPlay(@ScriptDir & "\focus_Audio\TreeView.wav")             Case Else                 SoundPlay(@ScriptDir & "\focus_Audio\focus.wav")         EndSwitch     EndIf     $h_CurrentHWNDFocus = $h_NewHWNDFocus     $h_CurrentControlHWNDFocus = $h_NewControlHWNDFocus     AdlibRegister("WindowAudioFocus", 50)     Return 1 EndFunc   ;==>WindowAudioFocus Func _IsCheckBox($ctrl_hwnd)     $Style = _WinAPI_GetWindowLong($ctrl_hwnd, $GWL_STYLE)     Return BitAND($Style, $BS_CHECKBOX) = $BS_CHECKBOX EndFunc   ;==>_IsCheckBox Func _IsRadio($ctrl_hwnd)     $Style = _WinAPI_GetWindowLong($ctrl_hwnd, $GWL_STYLE)     Return BitAND($Style, $BS_AUTORADIOBUTTON) = $BS_AUTORADIOBUTTON EndFunc   ;==>_IsRadio
      what i need from you is :
      play a sound when a menu item focus, that sound named menu.wav
      play a sound named items.wav when the users move on list box items or list view or treeview items or a combobox items
      please if can any one help me i'll very happy
      thanks on advance
    • By TheAutomator
      Is there a (simple) way to make your script using a picture-control to resize the gui?
      This would be useful for a transparant pop-up window with a custom made theme using picture controls:
      $Form = GUICreate('', 301, 173, 5, 5, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUICtrlCreatePic(@scriptdir & "\resize_win.bmp", 0, 73, 20, 51) ; some api call or code telling the os to use this picture as a resize border GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) GUISetState(@SW_SHOW) While True if GUIGetMsg() = $GUI_EVENT_CLOSE then Exit WEnd  
      EDIT: to make it more clear what i wanna do, if you go with the mouse arrow over the border of a re-sizable window the arrow changes to a "resize" arrow, you click and drag the border and then the window size adjusts to the mouse position until you release the mouse button.
      I want my picture control to be used the same way as the resize border to resize my window.
    • By Viszna
      Why does Windows 10 "AutoIt Window Info" give the wrong window position?
      WinMove() moves the window to a different point than parameters? -look script

      The test script moves the notepad.exe window to 0, 0, the real window coordinates are 8, 0
      Modified script add WinGetPos() and MouseMove() and MouseGetPos()
      #include <ScreenCapture.au3> Local $iPID = Run("notepad.exe", "") WinWait("[CLASS:Notepad]", "", 10); Wait 10 seconds for the Notepad window to appear. WinMove ("[CLASS:Notepad]", "", 0, 0, 600, 400) WinActivate("[CLASS:Notepad]") Send("WinMove ('[CLASS:Notepad]', "", 0, 0, 600, 400){ENTER}") Send("@DesktopWidth: " & @DesktopWidth & "{ENTER}") Send("@DesktopHeight: " & @DesktopHeight & "{ENTER}") Send("@DesktopDepth: " & @DesktopDepth & "{ENTER}") Send("@OSArch: " & @OSArch & "{ENTER}") Send("@OSBuild: " & @OSBuild & "{ENTER}") Send("@OSServicePack: " & @OSServicePack & "{ENTER}") Send("@OSType: " & @OSType & "{ENTER}") Send("@OSVersion: " & @OSVersion & "{ENTER}") Send(WinGetPos("[CLASS:Notepad]") & "{ENTER}") Send("X: " & WinGetPos("[CLASS:Notepad]")[0] & "{ENTER}") Send("Y: " & WinGetPos("[CLASS:Notepad]")[1] & "{ENTER}") Send("Width: " & WinGetPos("[CLASS:Notepad]")[2] & "{ENTER}") Send("Height: " & WinGetPos("[CLASS:Notepad]")[3] & "{ENTER}") MouseMove(0,400) Send("MouseMove(0,400){ENTER}") Send("MouseGetPos() X: " & MouseGetPos()[0] & "Y: " & MouseGetPos()[1]) Sleep(100) _ScreenCapture_Capture('C:\temp\screen.bmp',0,0,800,600) MsgBox(0,"Info","Save screen to C:\temp\screen.bmp" & @CRLF & "Click OK to view the bitmap") Run("explorer.exe C:\temp\screen.bmp") Is ALWAYS such a difference 8px (in every Windows 7, 8, Server)?
    • By timmy2
      I have the impression that the traditional method for processing responses to a GUI is to assign variables to each GUICreateButton (or Pic) and then use Switch/Case/Endswitch to detect when any Control is clicked.  In the tutorials I've seen about Koda it appears to use this method, too.
      While 1 Global $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Pic2 Call("verizon") Case $Pic3 Call("skype") Case $PicExit Exit EndSwitch WEnd But in a few examples I've seen a script use a different method. The script always includes the following option near the top:
      Opt("GUIOnEventMode", 1) ...and then, later, after creating each Control for the GUI, there's the function, GUICtrlSetOnEvent.  In these cases a very simple While/WEnd loop is used to wait for the user to respond. 
      I happened to employ this second method in a recent script where I used "canned" controls (checkbox and buttons). Later in the same script I used the GuiCreatePic and Switch/Case/EndSwitch method because my GUI was all custom images. (I'm not sure if that's necessary, but it's what I've deduced.) The second GUI failed to respond to any mouse clicks, but eventually I figured out the cause was the GUIOnEvenMode being enabled at the top of the script.
      This is when I realized I don't understand the reasoning behind choosing between these two methods. And I'm having no luck phrasing an appropriate search criterion. Is there an overview somewhere that explains the two methods and -- most importantly -- describes when each is appropriate?
    • By therks
      I'm trying to create a simple clock widget that automatically scales the text to the size of the window. I came up with the following method, but it doesn't work as well as I'd like. It especially has trouble scaling to the width of the window for some reason (in the example, try resizing the window to be narrow and tall).
      Does anyone have a better method?
      #include <Misc.au3> #include <WinAPIConv.au3> #include <GUIConstants.au3> #include <GDIPlus.au3> Opt('MustDeclareVars', 1) Global $_FONT_FAMILY = 'Arial', $_LB_TEXT Main() Func Main() _GDIPlus_Startup() Local $hGUI GUIRegisterMsg($WM_SIZE, WM_SIZE) $hGUI = GUICreate('', 300, 100, Default, Default, $WS_OVERLAPPEDWINDOW, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) $_LB_TEXT = GUICtrlCreateLabel('This is a string', 0, 0, 300, 100, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont($_LB_TEXT, _MeasureString($hGUI, GUICtrlRead($_LB_TEXT), $_FONT_FAMILY), 0, 0, $_FONT_FAMILY, 5) GUISetState() Local $iGM While 1 $iGM = GUIGetMsg() Switch $iGM Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd _GDIPlus_Shutdown() EndFunc Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) GUICtrlSetFont($_LB_TEXT, _MeasureString($hWnd, GUICtrlRead($_LB_TEXT), $_FONT_FAMILY), 0, 0, $_FONT_FAMILY, 5) EndFunc Func _MeasureString($hWnd, $sString, $sFont = 'Arial') Local $iError, $aSize, $hGraphic, $hFormat, $hFamily, $tLayout, $iFontSize, $hFont, $aInfo If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) EndIf $aSize = WinGetClientSize($hWnd) $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd) $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate($sFont) $tLayout = _GDIPlus_RectFCreate(0, 0, $aSize[0], $aSize[1]) $iFontSize = 0 Do If Not $hFamily Then $iError = 1 $iFontSize = 10 ExitLoop EndIf $iFontSize += 1 $hFont = _GDIPlus_FontCreate($hFamily, $iFontSize, 0) $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $sString, $hFont, $tLayout, $hFormat) _GDIPlus_FontDispose($hFont) If $aInfo[1] = 0 Then ExitLoop Until DllStructGetData($aInfo[0], 3) >= $aSize[0] Or DllStructGetData($aInfo[0], 4) >= $aSize[1] $iFontSize -= 1 _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_GraphicsDispose($hGraphic) Return SetError($iError, 0, $iFontSize) EndFunc
  • Create New...