AutoHotkey Community

It is currently May 26th, 2012, 4:18 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: May 11th, 2008, 2:22 pm 
Offline

Joined: May 14th, 2006, 8:31 pm
Posts: 45
I am trying to make the current thread immediately interruptable.

I currently have a work around where I have an msgbox with a timeout of 0.001, but you can still see it flash on the screen.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 11th, 2008, 3:06 pm 
Purpose? Code?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 11th, 2008, 3:47 pm 
Offline

Joined: May 14th, 2006, 8:31 pm
Posts: 45
My code works fine with an msgbox, but not at all without it. Here is what I think is occuring. When you click on an altsubmit listview A_GuiControlEvent "I" occures before A_guiControlEvent "Normal", but my code does not work with "I" getting called first, because on "I" a very large number of variables get changed that are needed for the functions that get called on "normal". Therefore I need "normal" to occure before "I". By putting an msgbox, it makes the thread for "I" immediately interruptable, so that "normal" inturrupts "I" and is then able to run its course before "I" messes with it's variables. At least, this is my theory.


Code that doesn't work.
Code:
Gui, 13:Add, ListView, x26 y40 w430 h480 +altsubmit vABook gLVRules, Name|Address

LVRules:
if A_GuiControlEvent=I
{
RUNS A BUNCH OF FUNCTIONS....
}

if (A_GuiControlEvent="Normal" or A_GuiControlEvent="RightClick")
{
RUNS A BUNCH OF Other FUNCTIONS....




Code that works great every time, except that you see an msgbox flash on the screen.
Code:
Gui, 13:Add, ListView, x26 y40 w430 h480 +altsubmit vABook gLVRules, Name|Address

LVRules:
if A_GuiControlEvent=I
{
msgbox,,,problem fixer,0.001
RUNS A BUNCH OF FUNCTIONS....
}

if (A_GuiControlEvent="Normal" or A_GuiControlEvent="RightClick")
{
RUNS A BUNCH OF Other FUNCTIONS....


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 11th, 2008, 3:54 pm 
ListView Documentation wrote:
Also, specifying Critical as the g-label's first line ensures that all "I" notifications are received (otherwise, some might be lost if the script cannot keep up with them).


this?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 12th, 2008, 9:25 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7501
Location: Australia
AutoHotkey has to check for window messages while a MsgBox is visible for the MsgBox to respond to user input. You may try using Sleep -1 instead:
Quote:
"Sleep -1": A delay of -1 does not sleep but instead makes the script immediately check its message queue. This can be used to force any pending interruptions to occur at a specific place rather than somewhere more random. See Critical for more details.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 12th, 2008, 10:54 pm 
Offline

Joined: May 14th, 2006, 8:31 pm
Posts: 45
Thanks for the help!


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: coinman, Google Feedfetcher, LazyMan, oldbrother, Yahoo [Bot] and 9 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group