Jump to content

MetroGUI UDF v5.1 - Windows 10 style buttons, toggles, radios, menu etc.


BBs19
 Share

Recommended Posts

On 22.10.2017 at 6:59 PM, x_bennY said:

Nice! thx! another question... is it possible to use more than one "OnAutoItExitRegisterOnAutoItExitRegister" in the same script?

And i'm trying to change the name of the button with the guictrlsetdata but it's not working, i took a look at the script and i don't think it's possible now, any ideas for the future? or to solve this?

Yes you can use more than one time according to the help file.

Link to comment
Share on other sites

Hi there, first of all congrats for your great work. This UDF really looks great. 

i am using it and created a GUI with two buttons:  "start"  and  "stop".

;Create  Buttons
    $sRunButton = _Metro_CreateButtonEx2("Run",498, 400, 90, 35)
    $sStopButton = _Metro_CreateButtonEx2("Stop",498, 437, 90, 35)

i alway use this function to check if the user press the "stop" button:

GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")


Func _WM_COMMAND($hWnd, $msg, $wParam, $lParam)
    If BitAND($wParam, 0x0000FFFF) = $sStopButton Then
        $stop = True
        _CheckStop()
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_COMMAND

But it doesn't work fine with this UDF since  either if i click the  $sRunButton or the $sStopButton it enters in the IF condition. I guess it might be caused because buttons are created as pictures. Is there a proper way to check if the $sStopButton is clciked anyhow?

 

Anyway, thank you for your great work.

Link to comment
Share on other sites

On 26.10.2017 at 9:57 AM, lillo78 said:

Hi there, first of all congrats for your great work. This UDF really looks great. 

i am using it and created a GUI with two buttons:  "start"  and  "stop".

;Create  Buttons
    $sRunButton = _Metro_CreateButtonEx2("Run",498, 400, 90, 35)
    $sStopButton = _Metro_CreateButtonEx2("Stop",498, 437, 90, 35)

i alway use this function to check if the user press the "stop" button:

GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")


Func _WM_COMMAND($hWnd, $msg, $wParam, $lParam)
    If BitAND($wParam, 0x0000FFFF) = $sStopButton Then
        $stop = True
        _CheckStop()
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_COMMAND

But it doesn't work fine with this UDF since  either if i click the  $sRunButton or the $sStopButton it enters in the IF condition. I guess it might be caused because buttons are created as pictures. Is there a proper way to check if the $sStopButton is clciked anyhow?

 

Anyway, thank you for your great work.

Why don't you use one of the methods used in the example files? One is with OnEventMode and the other is a normal while loop.

Your example also works fine for me. I used the example file for this UDF and added your code for a specific button.

GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")


Func _WM_COMMAND($hWnd, $msg, $wParam, $lParam)
    If BitAND($wParam, 0x0000FFFF) = $Button1 Then
        MsgBox(0, "", "")
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_COMMAND

 

On 22.10.2017 at 6:59 PM, x_bennY said:

Nice! thx! another question... is it possible to use more than one "OnAutoItExitRegisterOnAutoItExitRegister" in the same script?

And i'm trying to change the name of the button with the guictrlsetdata but it's not working, i took a look at the script and i don't think it's possible now, any ideas for the future? or to solve this?

You can't edit the text of buttons as they are pictures, they need to be recreated to edit the text. I might add this later, but for now you can use two buttons and hide one if you for example want a button that switches between Start / Stop 

Edited by BBs19
Link to comment
Share on other sites

I found out that it's caused because of disabling/enabling buttons. At the beginning the stop button is disabled.

;Create  Buttons
    $sRunButton = _Metro_CreateButtonEx2("Run",498, 400, 90, 35)
    $sStopButton = _Metro_CreateButtonEx2("Stop",498, 437, 90, 35)
    GUICtrlSetTip ($sRunButton, "Start Process")
    GUICtrlSetTip ($sStopButton, "Stop Process")

    _Metro_DisableButton($sStopButton)

and then when the start button is pressed i disable it and enable the stop button

Case $sRunButton

                ;Disable Start button
                _Metro_DisableButton($sRunButton)
                ;Enable Stop button
                _Metro_EnableButton($sStopButton)

So whenever i disable or enable a button it goes through the  _WM_COMMAND function. This doesn't happen using the regular GUI controls and interface. 

I have no idea why this is happening and how to solve it, so any idea and or suggestion is welcome.

Thanks

Link to comment
Share on other sites

@BBs19, I just runned the examples and clicked to maximize, then clicked the full Screen,  then the full screen again to go back to maximized, .... it did not like it, it would not go back. I had to hold the mouse button down and drag the control down to make it do what is supposed to do. Maybe you can look into it.

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

Link to comment
Share on other sites

1 hour ago, lillo78 said:

I found out that it's caused because of disabling/enabling buttons. At the beginning the stop button is disabled.

;Create  Buttons
    $sRunButton = _Metro_CreateButtonEx2("Run",498, 400, 90, 35)
    $sStopButton = _Metro_CreateButtonEx2("Stop",498, 437, 90, 35)
    GUICtrlSetTip ($sRunButton, "Start Process")
    GUICtrlSetTip ($sStopButton, "Stop Process")

    _Metro_DisableButton($sStopButton)

and then when the start button is pressed i disable it and enable the stop button

Case $sRunButton

                ;Disable Start button
                _Metro_DisableButton($sRunButton)
                ;Enable Stop button
                _Metro_EnableButton($sStopButton)

So whenever i disable or enable a button it goes through the  _WM_COMMAND function. This doesn't happen using the regular GUI controls and interface. 

I have no idea why this is happening and how to solve it, so any idea and or suggestion is welcome.

Thanks

I will check it out later. 

 

42 minutes ago, argumentum said:

@BBs19, I just runned the examples and clicked to maximize, then clicked the full Screen,  then the full screen again to go back to maximized, .... it did not like it, it would not go back. I had to hold the mouse button down and drag the control down to make it do what is supposed to do. Maybe you can look into it.

Oh damn the automated handling of the control buttons keeps causing problems.. The first v5 fullscreen was working fine. It must have sneaked in after the bugfixes, i haven't noticed as I am handling it manually for my programs.

I will fix it with the next update, for now you can do this:

Global $ControlBtnsAutoMode = False;Set automode off


;Handle the click manually.
Case $GUI_FULLSCREEN_BUTTON, $GUI_FSRestore_BUTTON
_Metro_FullscreenToggle($Form1)
ConsoleWrite("Fullscreen toggled" & @CRLF)
Link to comment
Share on other sites

On 2.11.2017 at 8:30 AM, lillo78 said:

I found out that it's caused because of disabling/enabling buttons. At the beginning the stop button is disabled.

;Create  Buttons
    $sRunButton = _Metro_CreateButtonEx2("Run",498, 400, 90, 35)
    $sStopButton = _Metro_CreateButtonEx2("Stop",498, 437, 90, 35)
    GUICtrlSetTip ($sRunButton, "Start Process")
    GUICtrlSetTip ($sStopButton, "Stop Process")

    _Metro_DisableButton($sStopButton)

and then when the start button is pressed i disable it and enable the stop button

Case $sRunButton

                ;Disable Start button
                _Metro_DisableButton($sRunButton)
                ;Enable Stop button
                _Metro_EnableButton($sStopButton)

So whenever i disable or enable a button it goes through the  _WM_COMMAND function. This doesn't happen using the regular GUI controls and interface. 

I have no idea why this is happening and how to solve it, so any idea and or suggestion is welcome.

Thanks

 

The HiWord in wParam is different when disabling and clicking, you are not checking that in your script.

Try this:

Func _WM_COMMAND($hWnd, $msg, $wParam, $lParam)
    If   BitShift($wParam, 16) = 0 And BitAND($wParam, 0xFFFF) = $sStopButton Then
        $stop = True
        _CheckStop()
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_COMMAND

 

Link to comment
Share on other sites

On 11/4/2017 at 11:51 AM, BBs19 said:

 

The HiWord in wParam is different when disabling and clicking, you are not checking that in your script.

Try this:

Func _WM_COMMAND($hWnd, $msg, $wParam, $lParam)
    If   BitShift($wParam, 16) = 0 And BitAND($wParam, 0xFFFF) = $sStopButton Then
        $stop = True
        _CheckStop()
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_COMMAND

 

That works great. Thanks so much!

Link to comment
Share on other sites

  • 3 weeks later...

This looks great, thanks for all the work.  I've just been playing with this and I need to be able to change the button text after it has been created, If I create the button the old way then it works but if I create the button in the metro way it never changes.  I can't see the equivalent of _Metro_GUICtrlSetData, am I missing something?

;$Button1 = GUICtrlCreateButton("Toggle", 472, 25, 81, 33, 0)
$Button1 = _Metro_CreateButton("Button Style 1", 472, 25,81,33)
GUICtrlSetData($Button1,"Change")

 

Link to comment
Share on other sites

On 6.11.2017 at 4:18 PM, Miliardsto said:

How to make this menu no disappear?

I see make it horizontally will be really difficult?

menu.jpg

Not possible at the moment, you would need to "move" all controls of the GUI to the right anyway. Horizontal menu might come some day, no gurantees yet.

 

1 hour ago, stephend said:

This looks great, thanks for all the work.  I've just been playing with this and I need to be able to change the button text after it has been created, If I create the button the old way then it works but if I create the button in the metro way it never changes.  I can't see the equivalent of _Metro_GUICtrlSetData, am I missing something?

;$Button1 = GUICtrlCreateButton("Toggle", 472, 25, 81, 33, 0)
$Button1 = _Metro_CreateButton("Button Style 1", 472, 25,81,33)
GUICtrlSetData($Button1,"Change")

 

Your answer is on the same page few posts above :D

Not possible at the moment. I planned it for later time when i rewrite the basics of the UDF.

 

-> I am currently working on another project. At the same time I am fixing bugs and adding some new features to the MetroUDF that i need for my other project. I don't have enough time to add complex new features to the MetroUDF at the moment.

But I am for sure not finished with this UDF yet :) 

Link to comment
Share on other sites

On 28/11/2017 at 4:17 PM, stephend said:

This looks great, thanks for all the work.  I've just been playing with this and I need to be able to change the button text after it has been created, If I create the button the old way then it works but if I create the button in the metro way it never changes.  I can't see the equivalent of _Metro_GUICtrlSetData, am I missing something?

;$Button1 = GUICtrlCreateButton("Toggle", 472, 25, 81, 33, 0)
$Button1 = _Metro_CreateButton("Button Style 1", 472, 25,81,33)
GUICtrlSetData($Button1,"Change")

 

Hi,

Static control (Label and Pic) of AutoIt v3 GUI can't change text/title with style SS_BITMAP (0x00E).

If you remove this style, it can't display bitmap.


Eg: 

#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>

$Form = GUICreate("Test", 350, 200, -1, -1)
GUISetState(@SW_SHOW)

;===========================================================
; it work correctly, but it can't display bitmap
$Label = GUICtrlCreateLabel("No title", 10, 10, 75, 25)
GUICtrlSetData($Label, "New title") ; yeah
GUICtrlSendMsg($Label, 0x0172, 0, _WinAPI_CreateSolidBitmap(0, 0x4F5F6F, 10, 10))
MsgBox(0, "", WinGetTitle(GUICtrlGetHandle($Label))) ; returned the old title


;===========================================================
; with SS_BITMAP
$Label2 = GUICtrlCreateLabel("No title", 10, 50, 75, 25, BitOR(0xE, $GUI_SS_DEFAULT_LABEL)) ; SS_BITMAP = 0xE
; not work
GUICtrlSetData($Label2, "New title")
WinSetTitle(GUICtrlGetHandle($Label2), '', "New title")
_WinAPI_SetWindowText(GUICtrlGetHandle($Label2), "New title")

GUICtrlSendMsg($Label2, 0x0172, 0, _WinAPI_CreateSolidBitmap(0, 0x4F5F6F, 10, 10))

; returned the old title
MsgBox(0, "Get title", WinGetTitle(GUICtrlGetHandle($Label2)))
; problem
MsgBox(0, "Get text", _WinAPI_GetWindowText(GUICtrlGetHandle($Label2)))
MsgBox(0, "Get text", WinGetText(GUICtrlGetHandle($Label2)))


;===========================================================
; same with Pic
$Pic = GUICtrlCreatePic("", 10, 100, 75, 25)
GUICtrlSetData($Pic, "New title")
GUICtrlSendMsg($Pic, 0x0172, 0, _WinAPI_CreateSolidBitmap(0, 0x4F5F6F, 10, 10))
MsgBox(0, "", WinGetTitle(GUICtrlGetHandle($Pic)))





Do
Until GUIGetMsg() = -3

 

My Solution: Add input data to Userdata of control.

I should you use this way for any control, not recommended use array, @BBs19 :D

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <Array.au3>

$Form = GUICreate("Form", 350, 200, -1, -1)
GUISetState(@SW_SHOW)

; create tag for DllStruct...
Global Const $tagMyOwnType =    'WCHAR  sText[255];' & _
                                'UINT   iColor;' & _
                                'LONG   iWidth;' & _
                                'LONG   iHeight'

$Data = DllStructCreate($tagMyOwnType)
; remember store it into memory, i'll add to array below
;Global $__aData[1] = [0]
;_ArrayAdd($__aData, $Data)

; set data
$Data.sText = 'Example'
$Data.iColor = 0x2D2D2D
$Data.iWidth = 50
$Data.iHeight= 50


$Label = GUICtrlCreateLabel($Data.sText, 10, 10, $Data.iWidth, $Data.iHeight, 0xE)
$hLabel = GUICtrlGetHandle($Label)
GUICtrlSendMsg($Label, 0x0172, 0, _WinAPI_CreateSolidBitmap(0, $Data.iColor, $Data.iWidth, $Data.iHeight))
; Set pointer to Userdata
_WinAPI_SetWindowLong($hLabel, $GWL_USERDATA, DllStructGetPtr($Data))

; Get Userdata from control, it return pointer
$Ptr = _WinAPI_GetWindowLong($hLabel, $GWL_USERDATA)
$DataGet = DllStructCreate($tagMyOwnType, $Ptr) ; add pointer to struct

MsgBox(0, 'Data from Label',    $DataGet.sText      & @CRLF & _
                                $DataGet.iColor     & @CRLF & _
                                $DataGet.iWidth     & @CRLF & _
                                $DataGet.iHeight    )
; Set new value for Userdata
$DataGet.sText = 'New text'

$Data2 = DllStructCreate($tagMyOwnType, _WinAPI_GetWindowLong($hLabel, $GWL_USERDATA))
MsgBox(0, 'Data changed', $DataGet.sText)

Do
Until GUIGetMsg() = -3

 

Edited by NHD
Link to comment
Share on other sites

7 hours ago, NHD said:

Hi,

Static control (Label and Pic) of AutoIt v3 GUI can't change text/title with style SS_BITMAP (0x00E).

If you remove this style, it can't display bitmap.


Eg: 

#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>

$Form = GUICreate("Test", 350, 200, -1, -1)
GUISetState(@SW_SHOW)

;===========================================================
; it work correctly, but it can't display bitmap
$Label = GUICtrlCreateLabel("No title", 10, 10, 75, 25)
GUICtrlSetData($Label, "New title") ; yeah
GUICtrlSendMsg($Label, 0x0172, 0, _WinAPI_CreateSolidBitmap(0, 0x4F5F6F, 10, 10))
MsgBox(0, "", WinGetTitle(GUICtrlGetHandle($Label))) ; returned the old title


;===========================================================
; with SS_BITMAP
$Label2 = GUICtrlCreateLabel("No title", 10, 50, 75, 25, BitOR(0xE, $GUI_SS_DEFAULT_LABEL)) ; SS_BITMAP = 0xE
; not work
GUICtrlSetData($Label2, "New title")
WinSetTitle(GUICtrlGetHandle($Label2), '', "New title")
_WinAPI_SetWindowText(GUICtrlGetHandle($Label2), "New title")

GUICtrlSendMsg($Label2, 0x0172, 0, _WinAPI_CreateSolidBitmap(0, 0x4F5F6F, 10, 10))

; returned the old title
MsgBox(0, "Get title", WinGetTitle(GUICtrlGetHandle($Label2)))
; problem
MsgBox(0, "Get text", _WinAPI_GetWindowText(GUICtrlGetHandle($Label2)))
MsgBox(0, "Get text", WinGetText(GUICtrlGetHandle($Label2)))


;===========================================================
; same with Pic
$Pic = GUICtrlCreatePic("", 10, 100, 75, 25)
GUICtrlSetData($Pic, "New title")
GUICtrlSendMsg($Pic, 0x0172, 0, _WinAPI_CreateSolidBitmap(0, 0x4F5F6F, 10, 10))
MsgBox(0, "", WinGetTitle(GUICtrlGetHandle($Pic)))





Do
Until GUIGetMsg() = -3

 

My Solution: Add input data to Userdata of control.

I should you use this way for any control, not recommended use array, @BBs19 :D

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <Array.au3>

$Form = GUICreate("Form", 350, 200, -1, -1)
GUISetState(@SW_SHOW)

; create tag for DllStruct...
Global Const $tagMyOwnType =    'WCHAR  sText[255];' & _
                                'UINT   iColor;' & _
                                'LONG   iWidth;' & _
                                'LONG   iHeight'

$Data = DllStructCreate($tagMyOwnType)
; remember store it into memory, i'll add to array below
;Global $__aData[1] = [0]
;_ArrayAdd($__aData, $Data) 

; set data
$Data.sText = 'Example'
$Data.iColor = 0x2D2D2D
$Data.iWidth = 50
$Data.iHeight= 50


$Label = GUICtrlCreateLabel($Data.sText, 10, 10, $Data.iWidth, $Data.iHeight, 0xE)
$hLabel = GUICtrlGetHandle($Label)
GUICtrlSendMsg($Label, 0x0172, 0, _WinAPI_CreateSolidBitmap(0, $Data.iColor, $Data.iWidth, $Data.iHeight))
; Set pointer to Userdata
_WinAPI_SetWindowLong($hLabel, $GWL_USERDATA, DllStructGetPtr($Data))

; Get Userdata from control, it return pointer
$Ptr = _WinAPI_GetWindowLong($hLabel, $GWL_USERDATA)
$DataGet = DllStructCreate($tagMyOwnType, $Ptr) ; add pointer to struct

MsgBox(0, 'Data from Label',    $DataGet.sText      & @CRLF & _
                                $DataGet.iColor     & @CRLF & _
                                $DataGet.iWidth     & @CRLF & _
                                $DataGet.iHeight    )

Do
Until GUIGetMsg() = -3

 

I have been playing around with DllStructCreate for a while now, I added some of the new features using it, because it clears up the code so well and reduces the complexity. I was planning on changing all functions to only use DllStructCreate..

However after running some tests, I was really dissapointed by the performance of it. Reading and writing data to it takes at least twice as much time as when you are working with arrays. I am thinking of implementing it only for details that don't require performance. Like in this case, adding specific details like text, color etc. in case it has to be accessed later. Im afraid for other things that require high performance like hover checking, other effects, loops etc. I will need to keep using arrays as I want everything as smooth as possible.

I wish the performance was the same, it would save so much time and make it easier to change things in the script later :D

 

Here a test script i wrote to compare the performance.  This should demonstrate the problem that would occur when trying to search for something specific in the struct.

_Test1() ;ignore first time, startup seems to cause some slowdown

_Test1()
_Test2()
_Test3()


Func _Test1()
    Local $a = TimerInit()
    Local $TestArray[10]
    $TestArray[0] = 100
    $TestArray[1] = 49
    $TestArray[2] = "test test"
    $TestArray[3] = 89
    $TestArray[4] = 2
    $TestArray[5] = 231
    $TestArray[6] = "Running"
    $TestArray[7] = "S05E08"
    $TestArray[8] = "Brooklyn Nine-Nine"
    $TestArray[9] = "Brooklyn Nine-Nine Brooklyn Nine-Nine Brooklyn Nine-Nine Brooklyn Nine-Nine Brooklyn Nine-Nine"
    
    ;Search for something specific in the array [assuming we have to search in 50 of these arrays].
    For $i = 0 To 49
        If $TestArray[5] = "xxx" And $TestArray[4] = "xxx" Then Return
    Next
    
    Local $TD = TimerDiff($a)
    ConsoleWrite($TD * 50 & " < Using array with index number" & @CRLF)
EndFunc   ;==>_Test1


Func _Test2()
    Local Enum $_x_, $_y_, $_text_, $_b_, $_c_, $_showname_, $_description_, $_showid_, $_show_status_, $_last_episode_
    
    Local $a = TimerInit()
    Local $TestArray[10]
    $TestArray[$_x_] = 100
    $TestArray[$_y_] = 49
    $TestArray[$_text_] = "test test"
    $TestArray[$_b_] = 89
    $TestArray[$_c_] = 2
    $TestArray[$_showid_] = 231
    $TestArray[$_show_status_] = "Running"
    $TestArray[$_last_episode_] = "S05E08"
    $TestArray[$_showname_] = "Brooklyn Nine-Nine"
    $TestArray[$_description_] = "Brooklyn Nine-Nine Brooklyn Nine-Nine Brooklyn Nine-Nine Brooklyn Nine-Nine Brooklyn Nine-Nine"

    ;Search for something specific in the array [assuming we have to search in 50 of these arrays].
    For $i = 0 To 49
        If $TestArray[$_showid_] = "xxx" And $TestArray[$_c_] = "xxx" Then Return
    Next
    
    Local $TD = TimerDiff($a)
    ConsoleWrite($TD * 50 & " < Using array with variables for index number" & @CRLF)

EndFunc   ;==>_Test2



Func _Test3()
    Local $ReadArray[50]
    
    Local $a = TimerInit()
    $oTest = DllStructCreate("int x;int y;wchar text[5];int b;int c;int showid;wchar ShowStatus[20];wchar ShowName[80];wchar ShowDescription[500];wchar lastEpisode[20]")
    $oTest.x = 100
    $oTest.y = 49
    $oTest.a = "test test"
    $oTest.b = 89
    $oTest.c = 2
    $oTest.showid = 231
    $oTest.ShowStatus = "Running"
    $oTest.ShowDescription = "Brooklyn Nine-Nine Brooklyn Nine-Nine Brooklyn Nine-Nine Brooklyn Nine-Nine Brooklyn Nine-Nine"
    $oTest.ShowName = "Brooklyn Nine-Nine"
    $oTest.LastEpisode = "S05E08"
    
    ;Search for something specific in the struct [assuming we have to search in 50 of these structs].

    For $i = 0 To 49
        If $oTest.showid = "xxx" And $oTest.c = "xxx" Then Return
    Next
    
    Local $TD = TimerDiff($a)
    ConsoleWrite($TD * 50 & " < Using DLLStructCreate" & @CRLF)
EndFunc   ;==>_Test3

These are the time results in ms (assuming we would need to search like this 50 times):
1.44351389605678 < Using array with index number
1.66067970342815 < Using array with variables for index number
3.25748711057061 < Using DLLStructCreate

Seems like not much of a difference but depening on how much data you need to store&read and how often, it can make a lot of difference. I used dllstruct like this it in another project for tv shows (storing details about the tv show, episodes etc.) and there was a difference of 30-40ms in the startup time compared to using arrays.

Edited by BBs19
Link to comment
Share on other sites

How did you get the impression that DllStructs should be as fast as arrays? They are completely different data types with completely different purposes. DllStructs are first of all implemented to support the DllCall command in passing parameters forth and back between AutoIt code and C++ code in Windows API functions. AutoIt arrays are standard safearrays of variants. They are notoriously fast.

That said, DllStructs can in many cases be very efficient in optimizing code for speed. Also code that involves arrays. But you have to test in each case.

If you find it advantageous to use DllStructs in your code, I'm pretty sure it'll work. Your code is mostly about mouse and keyboard events and DllStructs are sufficiently fast. And it's easy to test. Just count the number of events per second and measure the execution time of the code in the event handler. If you get 50 events per second the code in the event handler must not use more than 20 milliseconds.

Link to comment
Share on other sites

On 2.12.2017 at 3:47 PM, LarsJ said:

How did you get the impression that DllStructs should be as fast as arrays? They are completely different data types with completely different purposes. DllStructs are first of all implemented to support the DllCall command in passing parameters forth and back between AutoIt code and C++ code in Windows API functions. AutoIt arrays are standard safearrays of variants. They are notoriously fast.

That said, DllStructs can in many cases be very efficient in optimizing code for speed. Also code that involves arrays. But you have to test in each case.

If you find it advantageous to use DllStructs in your code, I'm pretty sure it'll work. Your code is mostly about mouse and keyboard events and DllStructs are sufficiently fast. And it's easy to test. Just count the number of events per second and measure the execution time of the code in the event handler. If you get 50 events per second the code in the event handler must not use more than 20 milliseconds.

Well I didn't think that they woud be as fast as arrays but I hoped that they would not cause such impact either. And you are right, it works for most cases without any impact, but you have to test it out with each case, with arrays you don't have to think about such problems:)

I was mostly concerned with the GUI effects handler, for example when the GUI gets active/inactive, I need to go very quickly through the controls array (get control type, id and bitmap handle from the same array) and set the buttons to an inactive color, this has to work pretty fast, otherwise it will look like each buttons color changes one by one instead of all at once. But I will need test it out all these cases and implement it everywhere it doesn't cause any impact on the performance.

Edited by BBs19
Link to comment
Share on other sites

Do you have more than 10,000 controls in your GUIs? I'll bet that as long as you have no more than 1,000 controls, DllStructs will not be a problem if you're writing proper code.

Link to comment
Share on other sites

where is effect responsible for slower appearing from tray (restoring) .

 

I got 2 guis on program and u know when I restore program from tray then metro gui appears slower (with fade effect) than normal gui.

 

I want to assign this effect to second gui or delete this

Edited by Miliardsto
Link to comment
Share on other sites

5 hours ago, t0nZ said:

Sounds like a newbie question I admit but testing MetroGUI example I get this on this include:

I can circumvent this ok, but I don't understand if something is wrong in my "include" setup.

Any ideas ?

 

 

error.PNG

u have these things included/declared before just find them and prevent to declare twice xd

In sublime text 3 is option find in folder. Put folder with ur project and enter name of this global variable which u want to find. Then you will fast find where it is

Link to comment
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
 Share

×
×
  • Create New...