-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to run winapi.MessageLoop() asyncronously? #32
Comments
What exactly do you mean by asynchronously? In a different thread? |
Probably, but I'm afraid having two threads will complicate things... I need to get window running, but still have console available to manipulate it. |
You'll have to implement that yourself somehow. Either with threads and queues or with coroutines and a custom repl (i.e. not one that is blocking waiting for key presses). |
It's kind of possible, (I've done it). You'll have to handle the messages loop yourself, it's very resourceful to look at the messages loop code in https://github.com/luapower/winapi/blob/master/winapi/basewindowclass.lua Functions to look for in
Here's some code I've written to show a window for 10 seconds then close it: win.visible = true
local endClock = os.clock() + 10
while true do
local continue, exitcode = winapi.ProcessNextMessage(math.max(endClock-os.clock(),0))
--Window has been closed manually.
if not continue and exitcode then break end
--Time over, close the window and confirm that.
if os.clock() >= endClock then
win:close()
winapi.MessageLoop()
break
end
end I hope my comment was useful even after 1 year of the issue creation. |
As it is now, repl terminal gets blocked when I launch
winapi.MessageLoop()
. Is there a way to start it asyncronously?Here is the code I'm using. The only difference from one on docs page is lack of
local
, it doesn't work in repl for some reason.I want to do
win.w=100
after the window is opened. From terminal.The text was updated successfully, but these errors were encountered: