Sign in to follow this  
Followers 0
PhoenixXL

Flickering Controls on WinMove

11 posts in this topic

#1 ·  Posted (edited)

Hey every1

I always used to make the GUI appear through a transparency of 0 to 255 (Fading Effect)

I wished i could have zoomed it while fading it

when i try to zoom the GUI,

the control flickers

Is there a Possible solution

Code:

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.8.1
Author: Abhishek

Script Function:
Template AutoIt script.

#ce ----------------------------------------------------------------------------


//#include-once
//#include <WindowsConstants.au3>
//#include <WinAPI.au3>
//#include <GDIPlus.au3>
//#include <GUIConstantsEx.au3>

; get height of window title and width of window frame - may be different when XP theme is ON/OFF
Global $htit = _WinAPI_GetSystemMetrics($SM_CYCAPTION)
Global $frame = _WinAPI_GetSystemMetrics($SM_CXDLGFRAME)
ConsoleWrite('Height:'&$htit&' Frame:'&$frame&@CRLF&@CRLF)

$gui=GUICreate('',100,100,-1,-1,-1,0)
GUISetState()
GUISetBkColor(0)
Sleep(10)
$hwnd=GUICtrlCreateLabel('Dust',10,10,80,80)
GUICtrlSetBkColor(-1,0xffffff)
GUICtrlSetResizing(-1, 102)
$hwnd=GUICtrlGetHandle(-1)
_Zoom($gui,300,200,-1)
Sleep(3000)
Func _Zoom($sHwnd,$iW=500,$iH=500,$nSpeed=-1)
Local $Pos=WinGetPos($sHwnd)
ConsoleWrite('X:'&$Pos[0]&' Y:'&$Pos[1]&' W:'&$Pos[2]&' H:'&$Pos[3]&@CRLF&@CRLF)
Local $hOffset,$wOffset,$nTimes
If $iH>$iW Then
$wOffset=1
$hOffset=$iH/$iW
$nTimes=$iW
ElseIf $iH<$iW Then
$wOffset=$iW/$iH
$hOffset=1
$nTimes=$iH
Else
$hOffset=1
$wOffset=1
$nTimes=$iH
EndIf

$Pos=WinGetPos($sHwnd)
$iH=0
$iW=0
For $i=1 To $nTimes
$iH+=$hOffset
$iW+=$wOffset
WinMove($sHwnd,'',$iW/2+($Pos[0]-$iW),$iH/2+($Pos[1]-$iH),$iW,$iH,$nSpeed)
Next

$Pos=WinGetPos($sHwnd)
ConsoleWrite('X:'&$Pos[0]&' Y:'&$Pos[1]&' W:'&$Pos[2]&' H:'&$Pos[3]&@CRLF&@CRLF)
EndFunc

Please guide me in the right direction

Edited by PhoenixXL

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



#2 ·  Posted (edited)

Try using the clip children style on it like this

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.8.1
Author: Abhishek

Script Function:
Template AutoIt script.

#ce ----------------------------------------------------------------------------



#include-once
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>

Global $MyStyle = BitOR($WS_CAPTION, $WS_SYSMENU, $WS_THICKFRAME, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_CLIPCHILDREN)

; get height of window title and width of window frame - may be different when XP theme is ON/OFF
Global $htit = _WinAPI_GetSystemMetrics($SM_CYCAPTION)
Global $frame = _WinAPI_GetSystemMetrics($SM_CXDLGFRAME)
ConsoleWrite('Height:' & $htit & ' Frame:' & $frame & @CRLF & @CRLF)

$gui = GUICreate('', 100, 100, -1, -1, $MyStyle)
GUISetState()
GUISetBkColor(0)
Sleep(10)
$hwnd = GUICtrlCreateLabel('Dust', 10, 10, 80, 80)
GUICtrlSetBkColor(-1, 0xffffff)
GUICtrlSetResizing(-1, 102)
$hwnd = GUICtrlGetHandle(-1)

_Zoom($gui, 300, 200, -1)

Sleep(3000)
Func _Zoom($sHwnd, $iW = 500, $iH = 500, $nSpeed = -1)
Local $Pos = WinGetPos($sHwnd)
ConsoleWrite('X:' & $Pos[0] & ' Y:' & $Pos[1] & ' W:' & $Pos[2] & ' H:' & $Pos[3] & @CRLF & @CRLF)
Local $hOffset, $wOffset, $nTimes
If $iH > $iW Then
$wOffset = 1
$hOffset = $iH / $iW
$nTimes = $iW
ElseIf $iH < $iW Then
$wOffset = $iW / $iH
$hOffset = 1
$nTimes = $iH
Else
$hOffset = 1
$wOffset = 1
$nTimes = $iH
EndIf

$Pos = WinGetPos($sHwnd)
$iH = 0
$iW = 0

GUISetStyle($MyStyle, -1, $gui); Set back to normal

For $i = 1 To $nTimes
$iH += $hOffset
$iW += $wOffset
WinMove($sHwnd, '', $iW / 2 + ($Pos[0] - $iW), $iH / 2 + ($Pos[1] - $iH), $iW, $iH, $nSpeed)
Next

GUISetStyle(BitAND($MyStyle, BitNOT($WS_CLIPCHILDREN)), -1, $gui); remove the clip children style

$Pos = WinGetPos($sHwnd)
ConsoleWrite('X:' & $Pos[0] & ' Y:' & $Pos[1] & ' W:' & $Pos[2] & ' H:' & $Pos[3] & @CRLF & @CRLF)

EndFunc ;==>_Zoom
Edited by ApudAngelorum

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

This code doesnt work

the label is still flickering

Code :

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.8.1
Author: Abhishek

Script Function:
Template AutoIt script.

#ce ----------------------------------------------------------------------------


#include-once
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>

; get height of window title and width of window frame - may be different when XP theme is ON/OFF
Global $htit = _WinAPI_GetSystemMetrics($SM_CYCAPTION)
Global $frame = _WinAPI_GetSystemMetrics($SM_CXDLGFRAME)
ConsoleWrite('Height:'&$htit&' Frame:'&$frame&@CRLF&@CRLF)

$gui=GUICreate('',100,100,-1,-1, BitOR($GUI_SS_DEFAULT_GUI,$WS_CLIPCHILDREN),0)
GUISetState()
GUISetBkColor(0)
Sleep(10)
$hwnd=GUICtrlCreateLabel('Dust',10,10,80,80)
GUICtrlSetBkColor(-1,0xffffff)
GUICtrlSetResizing(-1, 102)
$hwnd=GUICtrlGetHandle(-1)
_Zoom($gui,300,200,-1)
Sleep(3000)
Func _Zoom($sHwnd,$iW=500,$iH=500,$nSpeed=-1)
Local $Pos=WinGetPos($sHwnd)
ConsoleWrite('X:'&$Pos[0]&' Y:'&$Pos[1]&' W:'&$Pos[2]&' H:'&$Pos[3]&@CRLF&@CRLF)
Local $hOffset,$wOffset,$nTimes
If $iH>$iW Then
$wOffset=1
$hOffset=$iH/$iW
$nTimes=$iW
ElseIf $iH<$iW Then
$wOffset=$iW/$iH
$hOffset=1
$nTimes=$iH
Else
$hOffset=1
$wOffset=1
$nTimes=$iH
EndIf

$Pos=WinGetPos($sHwnd)
$iH=0
$iW=0
For $i=1 To $nTimes
$iH+=$hOffset
$iW+=$wOffset
WinMove($sHwnd,'',$iW/2+($Pos[0]-$iW),$iH/2+($Pos[1]-$iH),$iW,$iH,$nSpeed)
Next

$Pos=WinGetPos($sHwnd)
ConsoleWrite('X:'&$Pos[0]&' Y:'&$Pos[1]&' W:'&$Pos[2]&' H:'&$Pos[3]&@CRLF&@CRLF)
EndFunc
Edited by PhoenixXL

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

anyone ?


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

#5 ·  Posted (edited)

anyone ?

What operating system are you using?

Something tells me you're using vista 64bit right?

And just to note this, the reply you made where you said "Your COde", that is not the code I had posted ;)

Edited by ApudAngelorum

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

You may be able to stop it happening using the window style $WS_EX_COMPOSITED when creating the GUI.

Share this post


Link to post
Share on other sites

You may be able to stop it happening using the window style $WS_EX_COMPOSITED when creating the GUI.

Yes, that too, but I don't mention it since I've had trouble with that style, in example, if you have more than 3-10 windows in one ui, resizing causes some strange anomalies, I'm pretty sure you know what I mean, but in PhoenixXLs case, hopefully, it might not be a problem if using only a few controls.

I think there is also a problem with that style and having a list view control in the ui as well.


Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

if you have more than 3-10 windows in one ui, resizing causes some strange anomalies, I'm pretty sure you know what I mean,

I think there is also a problem with that style and having a list view control in the ui as well.

I was not aware of these things. I'll bear it in mind if I come across issues. Thanks.

Share this post


Link to post
Share on other sites

Yes, I became aware of this when creating the SciTE clone script thing, I was using windows and controls left and right, until I resized the window and BOOM.

100% CPU usage everywhere.

And searching the style name on the forums brought up other users with that style. More n

But it seems that if you're using that style for something frivolous and simple, then give it a go.


Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

thnx to both of u

$WS_EX_COMPOSITED solved the problem

maybe there would be problems ahead

And just to note this, the reply you made where you said "Your COde", that is not the code I had posted ;)

My mistake edited that :)

BTW I use win7 32bit


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

#11 ·  Posted (edited)

Working code

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.8.1
Author: Abhishek

Script Function:
Template AutoIt script.

#ce ----------------------------------------------------------------------------


#include-once
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>

; get height of window title and width of window frame - may be different when XP theme is ON/OFF
Global $htit = _WinAPI_GetSystemMetrics($SM_CYCAPTION)
Global $frame = _WinAPI_GetSystemMetrics($SM_CXDLGFRAME)
ConsoleWrite('Height:'&$htit&' Frame:'&$frame&@CRLF&@CRLF)

$gui=GUICreate('',100,100,-1,-1, BitOR($GUI_SS_DEFAULT_GUI,$WS_CLIPCHILDREN),$WS_EX_COMPOSITED)
GUISetState()
GUISetBkColor(0)
Sleep(10)
$hwnd=GUICtrlCreateLabel('Dust',10,10,80,80)
GUICtrlSetBkColor(-1,0xffffff)
GUICtrlSetResizing(-1, 102)
$hwnd=GUICtrlGetHandle(-1)
_Zoom($gui,300,200,1)
Sleep(3000)
Func _Zoom($sHwnd,$iW=500,$iH=500,$nSpeed=-1)
Local $Pos=WinGetPos($sHwnd)
ConsoleWrite('X:'&$Pos[0]&' Y:'&$Pos[1]&' W:'&$Pos[2]&' H:'&$Pos[3]&@CRLF&@CRLF)
Local $hOffset,$wOffset,$nTimes
If $iH>$iW Then
$wOffset=1
$hOffset=$iH/$iW
$nTimes=$iW
ElseIf $iH<$iW Then
$wOffset=$iW/$iH
$hOffset=1
$nTimes=$iH
Else
$hOffset=1
$wOffset=1
$nTimes=$iH
EndIf

$Pos=WinGetPos($sHwnd)
$iH=0
$iW=0
For $i=1 To $nTimes
$iH+=$hOffset
$iW+=$wOffset
WinMove($sHwnd,'',$iW/2+($Pos[0]-$iW),$iH/2+($Pos[1]-$iH),$iW,$iH,$nSpeed)
Next

$Pos=WinGetPos($sHwnd)
ConsoleWrite('X:'&$Pos[0]&' Y:'&$Pos[1]&' W:'&$Pos[2]&' H:'&$Pos[3]&@CRLF&@CRLF)
EndFunc
Edited by PhoenixXL

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

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  
Followers 0