Wb-FreeKill Posted May 4, 2005 Share Posted May 4, 2005 Ive made this little script witch take a screenshot, and shows it in the gui. But i wanted it to update it as fast a possible, but even when doing it ecery 1 sec, it eats all the RAM by filling them up, and using alot of cpu time, can i somehow do this faster?#Include <GUIConstants.au3> Fileinstall("captdll.dll","captdll.dll",1) Global $n GUICreate("Screen Capture",400,400) $Button = GUICtrlCreateButton("Take Screenshot",50,330,100,22) $Label = GUICtrlCreateLabel("- - ",50,360,70,20) $Dll = DllOpen("captdll.dll") $Picname = "SS_Full.jpg" GUISetstate() While 1 $Msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $Msg = $Button Then $x = 1 While 1 Sleep(1000) GUICtrlSetdata($Label,$x) GUICtrlDelete($n) DllCall($Dll, "int", "CaptureScreen", "str", $Picname, "int", 80) $n=GUICtrlCreatePic($Picname,0,0,300,300) ;GUICtrlSetState($n, $GUI_DISABLE) $n=GUICtrlSetPos($n,0,0,395,320) $x = $x+1 WEnd EndIf WEndScreenshotGUI.exe Link to comment Share on other sites More sharing options...
Lazycat Posted May 5, 2005 Share Posted May 5, 2005 (edited) First of all, you have error in you script: you assign $n=GUICtrlSetPos($n,0,0,395,320), so in next cycle $n is not control ID anymore, so you not delete control -> RAM full. Anyway, no need to delete control, GUICtrlSetImage do work better. CPU usage you can reduce if you have use bmp instead jpg. Jpg is cpu intensive thing. #Include <GUIConstants.au3> Fileinstall("captdll.dll","captdll.dll",1) Global $n GUICreate("Screen Capture",400,400) $Button = GUICtrlCreateButton("Take Screenshot",50,330,100,22) $Label = GUICtrlCreateLabel("- - ",50,360,70,20) $Dll = DllOpen("captdll.dll") $Picname = "SS_Full.jpg" DllCall($Dll, "int", "CaptureScreen", "str", $Picname, "int", 80); Create first pic $n=GUICtrlCreatePic($Picname,0,0,395,320) GUISetstate() While 1 $Msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $Msg = $Button Then $x = 1 While 1 Sleep(500) GUICtrlSetdata($Label,$x) DllCall($Dll, "int", "CaptureScreen", "str", $Picname, "int", 80) GUICtrlSetImage($n, $Picname) GUICtrlSetPos($n,0,0,395,320) $x = $x+1 WEnd EndIf WEnd Edited May 5, 2005 by Lazycat Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
buzz44 Posted May 5, 2005 Share Posted May 5, 2005 (edited) Have you tried Lazycat's ScreenShot DLL script to see if its any faster? Link is on the bottom of his sig.Edit: I must sound like an idiot! I didn't even see Lazycat's post lol. I guess I just read the first post and replied lol. Edited May 5, 2005 by Burrup qq Link to comment Share on other sites More sharing options...
Wb-FreeKill Posted May 5, 2005 Author Share Posted May 5, 2005 Okay its working much better now, thanks... but the image i put in my GUI is very blur, its because it have been scaled down right? Can i rezise it so it would be much more clear to see whats on the pic? Link to comment Share on other sites More sharing options...
Lazycat Posted May 5, 2005 Share Posted May 5, 2005 You can - in third party app But this anyway will lose details and will not be much more clear. If application support filtering by one of resizing algorithms (bilinear, bicubic, lanczos etc) you will get better quality, but most likely not satisfied by speed... Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
Wb-FreeKill Posted May 5, 2005 Author Share Posted May 5, 2005 You can - in third party app But this anyway will lose details and will not be much more clear. If application support filtering by one of resizing algorithms (bilinear, bicubic, lanczos etc) you will get better quality, but most likely not satisfied by speed...<{POST_SNAPBACK}>hmm, is there another way to make the pic smaller or easier to see 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