| View previous topic :: View next topic |
| Author |
Message |
acowbear
Joined: 14 May 2006 Posts: 45
|
Posted: Sun May 11, 2008 1:22 pm Post subject: Make a thread immediately interruptable |
|
|
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. |
|
| Back to top |
|
 |
n-l-i-d Guest
|
Posted: Sun May 11, 2008 2:06 pm Post subject: |
|
|
| Purpose? Code? |
|
| Back to top |
|
 |
acowbear
Joined: 14 May 2006 Posts: 45
|
Posted: Sun May 11, 2008 2:47 pm Post subject: |
|
|
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....
|
|
|
| Back to top |
|
 |
n-l-i-d Guest
|
Posted: Sun May 11, 2008 2:54 pm Post subject: |
|
|
| 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? |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 7293 Location: Australia
|
Posted: Mon May 12, 2008 8:25 am Post subject: |
|
|
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. |
|
|
| Back to top |
|
 |
acowbear
Joined: 14 May 2006 Posts: 45
|
Posted: Mon May 12, 2008 9:54 pm Post subject: |
|
|
| Thanks for the help! |
|
| Back to top |
|
 |
|