Jump to content

Recommended Posts

Posted
3 hours ago, WildByDesign said:

I notice that you quite often use StringLower in your switches when comparing class names in a few areas. Is this a choice specifically for improving performance of running through the switches?

It started with copy / paste and continued without the need of StringLower because string compare is not case sensitive in Autoit -> can be removed to improve performance.

3 hours ago, WildByDesign said:

Regarding window procedure functions. We can have many individual window procedure functions for different controls or we can have one big window procedure function for all subclassed controls. Would there be any difference in overall performance?

I would say use a hybrid approach using one shared function for controls that behave identically and dedicated functions for complex controls like the ListView, TreeView, etc.

Messages like WM_MOUSEMOVE or WM_NCHITTEST fire constantly and it doesn't make sense regarding performance to have huge different Case statements for every pixel the mouse moves, Also drawing complex GDI+ functions in WM_PAINT or WM_ERASEBKGND may reduce the overall performance.

 

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted (edited)

Running the code below results in an error in GUIDarkTheme.au3.

Func _GUIDarkTheme_GUICtrlAllSetDarkTheme($g_hGuiWnd, $bEnableDarkTheme = True, $bPreferNewTheme = False)

 

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <File.au3>
#include <String.au3>
#include <Array.au3>
#include "GuiCtrls_HiDpi.au3"
#include "GUIDarkTheme.au3"


$hGui = GUICreate("", 300, 200)

#Region MENU
Local $idMenu1 = GUICtrlCreateMenu("Menu &One")
Local $idMenu2 = GUICtrlCreateMenu("Menu &Two")
#EndRegion MENU

_GUIDarkTheme_ApplyDark($hGui)
GUISetState()

While 1
    Sleep(10)
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
WEnd

 

An @error check fixes the error.

 

Func _GUIDarkTheme_GUICtrlAllSetDarkTheme($g_hGuiWnd, $bEnableDarkTheme = True, $bPreferNewTheme = False)
    Local $aCtrls = __WinAPI_EnumChildWindows($g_hGuiWnd, False)
    If @error = 0 Then
        For $i = 1 To $aCtrls[0][0]
            _GUIDarkTheme_GUICtrlSetDarkTheme($aCtrls[$i][0], $bEnableDarkTheme, $bPreferNewTheme)
        Next
    EndIf
    Local $aCtrlsEx = __WinAPI_EnumProcessWindows(0, False) ; allows getting handles for tooltips_class32, ComboLBox, etc.
    For $i = 1 To $aCtrlsEx[0][0]
        _GUIDarkTheme_GUICtrlSetDarkTheme($aCtrlsEx[$i][0], $bEnableDarkTheme, $bPreferNewTheme)
    Next
    Return $aCtrls
EndFunc   ;==>_GUIDarkTheme_GUICtrlAllSetDarkTheme

 

Edited by bladem2003
Posted
38 minutes ago, bladem2003 said:

An @error check fixes the error.

Nice work and thank you for the fix. :)

I knew that there was a crash when there were no controls added but I had no idea exactly where the crash was coming from. So I appreciate that you figured it out.

By the way, should there be an @error check on the second loop as well?

Posted
17 minutes ago, WildByDesign said:

...should there be an @error check..

..just passing by.
@error checking should be done everywhere.
We add it only after we experience and error but somebody else may crash because of "that didn't happen to me when..." and I call BS !
So yes, do add @error checking everywhere, or at least where the failure would crash the script.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted (edited)

That can't be wrong, so do it. 😉

PS: Thanks for your excellent work!

It's incredible that you have so much time and manage to accomplish all of this.

 

I'd like to mention that almost all of my posts are translated by Google Translate. Sorry.

 

Edited by bladem2003
Posted (edited)

I seem to have a bit of a roadblock in the overhauling/reorganizing of the window procedures used for subclassing. I am trying to organize things better but also make it so that it can support multiple of the same control types (eg. 2 or 3 ListViews, etc.). If this UDF is to be used on any AutoIt GUI, it would need to support multiple of any control type.

EDIT: I have resolved this issue now.

Edited by WildByDesign

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
×
×
  • Create New...