View Full Version : Why isn't this sendmessage working for me?
Mastiff
January 28th, 2007, 12:53 PM
I want to shut down Zoom Player from a script, and I thought sendmesage (or postmessage, which I've also tried) should be straightforward. Of course it wasn't... Here's my code:
local prosess = win.FindProcess("zplayer.exe")
if prosess ~= nil
then
WindowHandle = (win.FindProcessWindow(prosess))
print(WindowHandle)
win.PostMessage(WindowHandle,32817,88,2)
else
print("Zoom Player is not running")
end
I have tried the same stuff with regular sendmessage action, and it works perfectly. So why isn't it working here?
Ron
January 28th, 2007, 09:49 PM
The handle might be different that you end up with....
Mastiff
January 29th, 2007, 01:03 AM
But I tried this as well:
local prosess = win.FindProcess("zplayer.exe")
if prosess ~= nil
then
WindowHandle = (win.FindProcessWindow(win.FindProcess("zplayer.exe")))
print(WindowHandle)
win.PostMessage(WindowHandle,32817,88,2)
else
print("Zoom Player is not running")
Shouldn't that work?
Ron
January 29th, 2007, 06:56 AM
I meant the window handle that Girder uses in the regular SendMessage function and your WindowHandle might be different and hence things don't work. What is the targetting you use in the regular action, how many windows match that pattern?
Mastiff
January 29th, 2007, 10:43 AM
I first used the GML that Zoom Player exports (3.3 format), and then I added a send message action myself. I use zplayer.exe as the target (a necessary move because this is supposed to work on the carputer, with four different Zoom Player instances with renamed exe files - rear_zplayer.exe, right_zplayer.exe and so on), and I get two windows that match the targetting. But I think I see what you mean, if I target it at the second window that fits, class name TAPPLICATION, the regular send message action won't work. I need to target the window that has the class name TMainForm. So how do I target the correct part?
blubberhoofd
January 29th, 2007, 11:23 AM
Hi,
you could also kill the process by using:
local pid = win.FindProcess("zplayer.exe")
if pid ~= nil then handle = win.FindProcessWindow(pid) win.TerminateProcess(pid)end
as a temporary solution, or would there be drawbacks like not remembering resume states?
Mastiff
January 29th, 2007, 11:26 AM
Thanks, but I'm using that now. The drawback is that the system tray gets filled with icons from the nVIDIA DVD decoder when Zoom doesn't exit nicely.
Powered by vBulletin® Version 4.1.8 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.