Sign in to follow this  
Followers 0
Kikoolol

PixelGetColor 20 times slower on Vista Aero ?

13 posts in this topic

Hi !

This is my first post and i don't speak very good English.

I come from the french Forum, and this is my problem :

When I use the function "PixelGetColor" (who return the color of one pixel) on Windows XP, the function takes ~0,3 ms,

On windows Vista or Seven, the function takes ~20,3 MS for 1 Pixel ! When i disable the Aero theme and replace it with Windows Classique Theme

I get the same result as in XP. how can I do to get better results with Vista Aero ?

Sorry for my English

Posted Image

Thank you in advance, and thanks to Google translation

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Aero is that slow on GDI+ on certain functions, there is nothing you can do about it. Either tell whoever is gonna run your script to disable it manually or run this code to do it automatically while the script is running:

DllCall("dwmapi.dll", "uint", "DwmEnableComposition", "int", 0)

Edit: BTW it's not really Aero that's causing the slowliness, it's DWM. But whatever, usually both are activated.

Edited by AdmiralAlkex

Share this post


Link to post
Share on other sites

Thanks a lot >_<

But how can i know if the user have the "GDI +" enabled ?

I would do this :

If "Gdi Enabled" Then

Msgbox("omg, would you like to disable the GDI ?")

If Yes DllCall ( "dwmapi.dll", "uint", "DwmEnableComposition", "int", 0)

If No

Endif

Thanks

Share this post


Link to post
Share on other sites

Maybe like this?

(only tested very quickly)

#include <GUIConstantsEx.au3>

GUICreate(1024, 768)
GUISetState()

If _DwmIsEnabled() = True Then
    $Text = "By turning off DWM this script will be much much faster." & @CRLF & "Would you like me to turn off DWM for you?? (will be activated again when script end)"
    If MsgBox(4+32+262144, "It seems like you have DWM running.", $Text) = 6 Then _DwmEnable(False)
EndIf

Do
    Sleep(10)
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Func _DwmIsEnabled()
    If FileExists("dwmapi.dll") Then
        Local $Bool
        $aTemp = DllCall("dwmapi.dll", "uint", "DwmIsCompositionEnabled", "int*", $Bool)
        If $aTemp[1] = True Then
            Return 1
        Else
            Return SetError(1)
        EndIf
    Else
        Return SetError(2)
    EndIf
EndFunc

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

Share this post


Link to post
Share on other sites

Even when the Dwm is disable the msgbox appear >_

Share this post


Link to post
Share on other sites

up ? >_

Share this post


Link to post
Share on other sites

I see the problem (I think). Does this work better?

#include <GUIConstantsEx.au3>

GUICreate(1024, 768)
GUISetState()

If _DwmIsEnabled() = True Then
    $Text = "By turning off DWM this script will be much much faster." & @CRLF & "Would you like me to turn off DWM for you?? (will be activated again when script end)"
    If MsgBox(4+32+262144, "It seems like you have DWM running.", $Text) = 6 Then _DwmEnable(False)
EndIf

Do
    Sleep(10)
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Func _DwmIsEnabled()
    If FileExists(@SystemDir & "\dwmapi.dll") Then
        $Receiver = DllStructCreate("int")
        $aTemp = DllCall("dwmapi.dll", "uint", "DwmIsCompositionEnabled", "ptr", DllStructGetPtr($Receiver, 1))

        $Receiver2 = DllStructCreate("int", $aTemp[1])
        If DllStructGetData($Receiver2, 1) = True Then
            Return 1
        Else
            Return SetError(1, 0, 0)
        EndIf
    Else
        Return SetError(2, 0, 0)
    EndIf
EndFunc

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

Share this post


Link to post
Share on other sites

It's perfect >_<

Thanks a lot !

Share this post


Link to post
Share on other sites

Hi, sorry for the date, but i have detected a problem, on Windows Seven its perfect, but on Windows Vista, The Aero theme turns off, and reactivates immediately. How do to for made like Seven ?

Thanks

Share this post


Link to post
Share on other sites

Hi, sorry for the date, but i have detected a problem, on Windows Seven its perfect, but on Windows Vista, The Aero theme turns off, and reactivates immediately. How do to for made like Seven ?

Thanks

The code should work, I'm not sure why that is happening.

Maybe you should choose another method to disable DWM. One of the easiest ways would be to right-click the exe-file for your script (or whatever you're botting), press Properties, go to the tab "Compatibility", and check the checkbox that says "Disable desktop composition". That will disable dwm while the process is running.

Share this post


Link to post
Share on other sites

I see the problem (I think). Does this work better?

 

#include <GUIConstantsEx.au3>

GUICreate(1024, 768)
GUISetState()

If _DwmIsEnabled() = True Then
    $Text = "By turning off DWM this script will be much much faster." & @CRLF & "Would you like me to turn off DWM for you?? (will be activated again when script end)"
    If MsgBox(4+32+262144, "It seems like you have DWM running.", $Text) = 6 Then _DwmEnable(False)
EndIf

Do
    Sleep(10)
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Func _DwmIsEnabled()
    If FileExists(@SystemDir & "\dwmapi.dll") Then
        $Receiver = DllStructCreate("int")
        $aTemp = DllCall("dwmapi.dll", "uint", "DwmIsCompositionEnabled", "ptr", DllStructGetPtr($Receiver, 1))

        $Receiver2 = DllStructCreate("int", $aTemp[1])
        If DllStructGetData($Receiver2, 1) = True Then
            Return 1
        Else
            Return SetError(1, 0, 0)
        EndIf
    Else
        Return SetError(2, 0, 0)
    EndIf
EndFunc

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

 

That's works perfect for me, shuts down aero, but it left one question.

How can I make to stay on that state? I mean: If I switching off the DWM, it will switch itself back when the script ends. What can I do to keep in that state?

Thank You!

Share this post


Link to post
Share on other sites

You know this thread is over 4 years old?

 

...But the problem is still exists. Any solution?

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