How to simulate "MsgBox"

Ask for help, how to use AHK_H, etc.
arcticir
Posts: 471
Joined: 17 Nov 2013, 11:32

How to simulate "MsgBox"

21 Aug 2017, 07:46

I tried using the following code instead of "MsgBox".
It is very fast and supports selecting / editing / copying text
  Even loading a few MB of text is also extremely responsive.

But the "WinWaitClose" command brought a huge disaster.
We know that a script can have multiple "MsgBox" windows at the same time,
Before you click "OK", the thread is in a paused state.
This is very friendly.
And "WinWaitClose" is the opposite
It hinders other threads,
Even if other processes use "Accessible" to view this window,
It will make this process stagnant.
I spent a lot of time looking for the cause of the process of stagnation.

I try to find a perfect solution like "MsgBox" treat threads

I think, can we make precise opening / closing of threads?
E.g:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



So, can add a variable that marks the thread?
In order to accurately control the state of the thread.
What do you think?


Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

HotKeyIt
Posts: 1534
Joined: 29 Sep 2013, 18:35
Contact:

Re: How to simulate "MsgBox"

21 Aug 2017, 15:58

Thread Id can be retrieved via A_ThreadId.
Try PostThreadMessage(A_ThreadId, 65306) to pause the thread.
arcticir
Posts: 471
Joined: 17 Nov 2013, 11:32

Re: How to simulate "MsgBox"

21 Aug 2017, 18:10

I do not understand.
Take this example, how to restore the earliest suspended "A" thread?

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus




In addition, can there be any way to achieve this example of the program?

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

HotKeyIt
Posts: 1534
Joined: 29 Sep 2013, 18:35
Contact:

Re: How to simulate "MsgBox"

22 Aug 2017, 16:46

You can't pause a pseudo thread, it must be a real thread.

For some reason PostThreadMessage does not work, probably because of Messages sent by PostThreadMessage are not associated with a window.

Try this:

Code: [Select all] [Download] GeSHi © Codebox Plus

aThread:=ExeThread("#Persistent`nSetTimer `"a`", 100`nReturn`na:`nToolTip A_TickCount `" - `" A_ThreadId`nReturn")
Sleep 1000
aThreadHwnd:=aThread.ahkgetvar("A_ScriptHwnd")
b::
PostMessage_(aThreadHwnd, 0x111, 65306)
return

Esc::ExitApp
arcticir
Posts: 471
Joined: 17 Nov 2013, 11:32

Re: How to simulate "MsgBox"

22 Aug 2017, 18:13

This simply means that "65306" has the same functionality as "pause".
It does not solve the "pause" can not solve the problem.
thanks.

===========

I found a way to accurately restore a suspended thread.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


Return to “Ask For Help”

Who is online

Users browsing this forum: No registered users and 0 guests