Sign in to follow this  
Followers 0
GyuK

Alternatives for GuiGetMsg?

7 posts in this topic

is there any alternative for GuiGetMsg? seems that this function auto sleep and this is a problem cause i use it alot in my code, without any sleep in it im getting 0% cpu usage (and my processor is shitty) while to my code work properly i need it to use cpu, are there any other way to get the guimsg without the GuiGetMsg function or at least an way to GuiGetMsg dont sleep so i can manage the sleep of my code to it work the way i want?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

GyuK,

I have absolutely no idea what you mean by that. GUIGetMsg has a built-in sleep of up to 15ms to give the processor time to breathe - getting 0% CPU when nothing is happening is a good thing! ;)

However, if you want to try another way of doing things, you can use OnEvent mode - it has both advantages and disadvantages compared to MessageLoop mode, it is up to you to decide which is best for you and the particular script you are coding. Look in the Help file under <GUI Reference> to see how to use the 2 modes. :)

M23

Edit: Welcome to the AutoIt forum, by the way. :)

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

GyuK,

I have absolutely no idea what you mean by that. GUIGetMsg has a built-in sleep of up to 15ms to give the processor time to breathe - getting 0% CPU when nothing is happening is a good thing! ;)

 

 

the problem is that there is things happening, since the functions is long i need to call GuiGetMsg several times in the function otherwise the gui will be frozen till the function end

 

 

However, if you want to try another way of doing things, you can use OnEvent mode - it has both advantages and disadvantages compared to MessageLoop mode, it is up to you to decide which is best for you and the particular script you are coding. Look in the Help file under <GUI Reference> to see how to use the 2 modes. :)

 

ill try that, thanks

Share this post


Link to post
Share on other sites

GyuK,

 

the functions is long i need to call GuiGetMsg several times in the function otherwise the gui will be frozen

The Interrupting a running function tutorial in the Wiki might be of interest - it shows how to recognise control events while a long function is running. ;)

Or you might consider running this long function in a separate process - possibly by using an .a3x file run by the main script interpreter. There are several examples on the forum - let me know if you have problems finding one and I will write an example to show you what I mean. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

GyuK,

 

The Interrupting a running function tutorial in the Wiki might be of interest - it shows how to recognise control events while a long function is running. ;)

Or you might consider running this long function in a separate process - possibly by using an .a3x file run by the main script interpreter. There are several examples on the forum - let me know if you have problems finding one and I will write an example to show you what I mean. :)

M23

followed your second sugestion and ive made 3 files to simulate an multi-thread while sharing the variables that need to be shared in an ini file, now in the main file i only keep the gui and lowweight functions its working perfectly thanks for your help :D

Share this post


Link to post
Share on other sites

GyuK,

Glad I could help. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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