I'm trying to learn how to pass messages between 2 apps on the same system. The main app is displaying images constantly. The second app in runningn in the background is perodically checking for updates and moving content. The second app has to be able to either (a) shut down the first porgram and relaunch it or (b) pass a message to the first program that it can respond to and then exit.
I'm trying to use the windows commands from the styx add-on but with no luck whatsoever. After issuing make app message and post app message, query app messages continues to equal zero.
This code represents the first app. Its just sitting there waiting for query app meggages to equal anything other than zero:
set window on
set display mode 800,600,32
mainloop:
a = query app messages()
if a = 0 then winapi sleep 1000 : goto mainloop
a$ = get app message param1()
print a$
winapi sleep 2000
goto mainloop
Here's the second program, makking a message and then posting it. According to the doc, its supposed to post to all programs, even itself, but if I do the query app messages even from this program, the value remains zero.
set window on
set display mode 800,600,32
a$ = "Time to quit"
make app message 1,a$
post app message 1,"yotheremama","btw..."
sleep 20000
Tell me if you can, what am I doing wrong... OR of you know a better way to pass messages between apps, let me know. Since the finished app is for digital signage and will run continuously, I don't want it to be polling the hard drive constantly; otherwise, I would just leave a file on the drive that said,"hey, its time to shut down".