Sign in to follow this  
Followers 0
Dgameman1

Pixelsearch lag

8 posts in this topic

#1 ·  Posted (edited)

I feel as if the fact that pixelsearch is constantly checking to see if that color is there or not is making my system go slow.

Is there any way slow it down or just to do something where I'm not lagging..

This is the piece of code where I have pixel search

Global $test = "{END}"

While 1
    
                $perc5 = GUICtrlRead($AL1)
                $box5 = GUICtrlRead($check1)
                
    If $box5 = 1 Then ; Checkbox checked
        If $perc5 = 50 Then ; Combo set to 50
; Do the Pixelsearch
$aCoords = PixelSearch(351, 802, 374, 819, 0x555555, 5)
If @error = 0 Then
    ControlSend("[CLASS:Notepad]", "", "[CLASS:Edit]", $test)
EndIf
    EndIf
    Endif
Edited by Dgameman1

Share this post


Link to post
Share on other sites



Post a runnable (working) reproducer so we have any idea what you are doing.

And run this code:

MsgBox(0, "", "Is DWM on? " & (True = _DwmIsCompositionEnabled()) & @CRLF & "@error= " & @error)

Func _DwmIsCompositionEnabled()
    $aRet = DllCall(@SystemDir & "\Dwmapi.dll", "long", "DwmIsCompositionEnabled", "int*", "")
    If @error Then Return SetError(1, 0, 0)
    Return $aRet[1]
EndFunc

What does it tell you?

Share this post


Link to post
Share on other sites

A msgbox popped up with the words

"Is DWM on? True

@error= 0"

Share this post


Link to post
Share on other sites

GDI(+) is done by your cpu if DWM is on, so you want to disable that.

  • Do a search for "disable dwm" or something like that on google or forum
  • Call the function "DwmEnableComposition", (example at bottom of post) *
  • Change compatibility settings *
  • Change screen bit-depth
  • Change Windows theme
  • Disable "Enable desktop composition" from "Advanced system settings"
  • Don't use a WDDM driver
  • Probably some other ways to skin this cat.... Search and you shall find

*The two least intrusive methods IMO.

.....

And I hope you have a Sleep() somewhere.

_DwmEnable(False)
Sleep(3000)
_DwmEnable(True)
Sleep(3000)
_DwmEnable(False)
Sleep(3000)

Func _DwmEnable($WhatToDo)
    DllCall("dwmapi.dll", "long", "DwmEnableComposition", "uint", $WhatToDo)
EndFunc

Share this post


Link to post
Share on other sites

I honestly have absolutly no idea why you would want me to do that?

DWM makes windows 7 have all the pretty effects and such and it makes sense that you would want me to disable it since it would be taking of cpu ness

But the CPU part of DWM never goes higher than 01 as far as I've seen and the Memory part of it is currently at 13k which isn't very much on my computer.

My computer's specs are...

Intel® Core2 Duo CPU

2.80 Ghz

4.00 GB Ram

450 GB Total space

64bit Windows 7...

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I honestly have absolutly no idea why you would want me to do that?

You said you wanted more speed. GDI is not hardware accelerated with DWM, so yes, you want it disabled.

But the CPU part of DWM never goes higher than 01 as far as I've seen and the Memory part of it is currently at 13k which isn't very much on my computer.

Don't look at DWM, look at your script. It's the script that is slow.

If your problem is not this, then explain what it is you want, and post that reproducer. Guessing games is not of my interest at this time.

Edit: Rewording

Edited by AdmiralAlkex

Share this post


Link to post
Share on other sites

I reread what I wrote and I'm sorry for coming off as an asshole =/

I know you're trying to help.

Umm, maybe my other thread will help?

Sorry

Share this post


Link to post
Share on other sites

I'm sorry too if I was a bit harsh, but please understand that I'm just trying to get you to help us help you.

So I looked at the code in that thread and.... I don't know. Do you want your script to use less cpu? Add a Sleep().

Also you are not reading your checkbox the right way, see the Remarks-section for GUICtrlRead() in the helpfile.

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