Herb191 Posted June 9, 2015 Posted June 9, 2015 I have a script that changes cursor types in IE. It works fine without flashing until the window is resized. I am not sure why it’s happening or how to stop it. Is the only solution to completely reload the image?Example:expandcollapse popup#include <IE.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $sFileName = FileOpenDialog("Please select file", "", "Image files (*.jpg;*.tif;*.gif;*.bmp;*.png;)"); If @Error Then Exit $hGUI = GUICreate("", 500, 500, 0, 0, $WS_SIZEBOX + $WS_MAXIMIZEBOX, $WS_EX_COMPOSITED) $oIE = ObjCreate("Shell.Explorer.2") $g_idGUIActiveX = GUICtrlCreateObj($oIE, 0, 0, 500, 500) GUICtrlSetResizing($g_idGUIActiveX, $GUI_DOCKAUTO) ;navigate to image $oIE.navigate($sFileName) _IELoadWait($oIE) ;makes the HTML that will hold the image $sHTML = "<HTML><HEAD><SCRIPT language=jscript for=document type=text/javascript defer event=oncontextmenu>;return false</SCRIPT></HEAD>" $sHTML &= '<BODY style="BORDER-TOP: 0px; BORDER-RIGHT: 0px; BORDER-BOTTOM: 0px; MARGIN: 0px; BORDER-LEFT: 0px">' $sHTML &= '<IMG width=100% height=100% src="' & $sFileName & '"></BODY></HTML>' ;save the HTML to IE _IEDocWriteHTML($oIE, $sHTML) _IELoadWait($oIE) GUISetState(@SW_SHOW, $hGUI) ;remove the scroll bar $oIE.document.body.scroll = "no" ;first loop does not flash For $i = 10 To 1 Step -1 ToolTip($i, 0, 0, "First Loop") $oIE.document.body.style.cursor = "move" Sleep(500) $oIE.document.body.style.cursor = "n-resize" Next ;change window size WinSetState($hGUI, "", @SW_MAXIMIZE) ;second loop flashes once there is change in the window size For $i = 10 To 1 Step -1 ToolTip($i, 0, 0, "Second Loop With Flashing") $oIE.document.body.style.cursor = "move" Sleep(500) $oIE.document.body.style.cursor = "n-resize" Next
Herb191 Posted June 15, 2015 Author Posted June 15, 2015 (edited) For anyone that is interested.Removing $WS_EX_COMPOSITED stopped the flickering for me but I needed the double-buffering for what I was doing.I ended up having to disable the ActiveX control and then set the GUI’s cursor using GUISetCursor.Here is a working example for anyone that may run into the same problem.expandcollapse popup#include <IE.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $sFileName = FileOpenDialog("Please select file", "", "Image files (*.jpg;*.tif;*.gif;*.bmp;*.png;)"); If @error Then Exit $hGUI = GUICreate("", 500, 500, 0, 0, $WS_SIZEBOX + $WS_MAXIMIZEBOX, $WS_EX_COMPOSITED) $oIE = ObjCreate("Shell.Explorer.2") $g_idGUIActiveX = GUICtrlCreateObj($oIE, 0, 0, 500, 500) GUICtrlSetResizing($g_idGUIActiveX, $GUI_DOCKAUTO) ;navigate to image $oIE.navigate($sFileName) _IELoadWait($oIE) ;makes the HTML that will hold the image $sHTML = "<HTML><HEAD><SCRIPT language=jscript for=document type=text/javascript defer event=oncontextmenu>;return false</SCRIPT></HEAD>" $sHTML &= '<BODY style="BORDER-TOP: 0px; BORDER-RIGHT: 0px; BORDER-BOTTOM: 0px; MARGIN: 0px; BORDER-LEFT: 0px">' $sHTML &= '<IMG width=100% height=100% src="' & $sFileName & '"></BODY></HTML>' ;save the HTML to IE _IEDocWriteHTML($oIE, $sHTML) _IELoadWait($oIE) GUICtrlSetState($g_idGUIActiveX, $GUI_DISABLE);<<<<<<<<<<disable GUISetState(@SW_SHOW, $hGUI) ;remove the scroll bar $oIE.document.body.scroll = "no" ;first loop does not flash For $i = 10 To 1 Step -1 ToolTip($i, 0, 0, "First Loop") GUISetCursor(9, 1, $hGUI) Sleep(500) GUISetCursor(2, 1, $hGUI) Next ;change window size WinSetState($hGUI, "", @SW_MAXIMIZE) ;second loop /w no flash For $i = 10 To 1 Step -1 ToolTip($i, 0, 0, "First Loop") GUISetCursor(9, 1, $hGUI) Sleep(500) GUISetCursor(2, 1, $hGUI) Next Edited June 15, 2015 by Herb191 Fixed formatting error.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now