Jump to content

Alternatives for GuiGetMsg?


Go to solution Solved by Melba23,

Recommended Posts

Posted

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
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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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:

  Reveal hidden contents

 

Posted

  On 5/23/2014 at 4:56 PM, Melba23 said:

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

 

 

  On 5/23/2014 at 4:56 PM, Melba23 said:

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

  • Moderators
  • Solution
Posted

GyuK,

 

  Quote

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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:

  Reveal hidden contents

 

Posted

  On 5/23/2014 at 6:28 PM, Melba23 said:

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

  • Moderators
Posted

GyuK,

Glad I could help. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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:

  Reveal hidden contents

 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...