ChrisL Posted February 22, 2008 Share Posted February 22, 2008 When using anygui to add a picture to another gui sometimes if another window is dragged over the top the added picture doesn't always repaint. (See attached screen shot) I can force it to repaint every 10 seconds or so but I was looking for a more elegant method for triggering a repaint. Is it possible to detect when another window has been dragged over the top of your gui? #include <guiconstants.au3> #include <anyguiv2.8.au3> Run ( "calc" ) WinWait ( "Calculator" ) $Pos = WinGetPos ( "Calculator" ) WinMove ( "Calculator", '', (@DesktopWidth-$Pos[2])/2, (@DesktopHeight-$Pos[3])/2, $Pos[2] + 47, $Pos[3] ) _GuiTarget ( "Calculator", 1 ) $Quit = _TargetAddButton ( "Quit", $Pos[2]-10, 37, 50, 29 ) $Quit = $Quit[0] GUISetState ( ) _TargetAddLabel ( "Notepad", $Pos[2]-10, 66, 50, 18 ) GUISetState ( ) _TargetAddPic ( "D:\My Documents\AutoITscripts\OrderManager2\gfx\ONButton.bmp", $Pos[2]-10, 84, 50, 115 ) GUISetState ( ) While 1 $msg = GUIGetMsg ( ) If $msg = $Quit Then Exit If Not WinExists ( "Calculator" ) Then Exit WEnd Func OnAutoItExit() ProcessClose ( "calc.exe" ) EndFunc [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Siao Posted February 22, 2008 Share Posted February 22, 2008 Is it possible to detect when another window has been dragged over the top of your gui?Not without polling (or system-wide hook) to check your window's rectangle against suspects' rectangles with IntersectRect API, I think. Anyway, your problem is repaint, so that's what you should concentrate on. ;... $aPic = _TargetAddPic ( "D:\My Documents blah blah") GUIRegisterMsg($WM_PAINT, 'WM_PAINT') ;... Func WM_PAINT($hWnd, $Msg, $wParam, $lParam) _WinAPI_InvalidateRect($aPic[1]) Return $GUI_RUNDEFMSG EndFunc as a start. "be smart, drink your wine" Link to comment Share on other sites More sharing options...
ChrisL Posted February 22, 2008 Author Share Posted February 22, 2008 Thats great thanks! [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
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