GyuK Posted May 23, 2014 Posted May 23, 2014 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?
Moderators Melba23 Posted May 23, 2014 Moderators Posted May 23, 2014 (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. M23Edit: Welcome to the AutoIt forum, by the way. Edited May 23, 2014 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
GyuK Posted May 23, 2014 Author Posted May 23, 2014 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
LarsJ Posted May 23, 2014 Posted May 23, 2014 Take a look at this example. Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions
Moderators Solution Melba23 Posted May 23, 2014 Moderators Solution Posted May 23, 2014 GyuK, the functions is long i need to call GuiGetMsg several times in the function otherwise the gui will be frozenThe 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
GyuK Posted May 23, 2014 Author Posted May 23, 2014 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
Moderators Melba23 Posted May 24, 2014 Moderators Posted May 24, 2014 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now