How does one close a running VNCViewer?
markj "at" critical.co.uk
Fri Apr 1 12:32:00 2005
Mark Jacobs wrote:
>I have a program that monitors the sound streamed off another PC, and
>also spawns VNCViewer to show its remote screen. When I stop the audio
>monitoring, I would like to be able to close any running VNCViewer as
>well. Is there any way of doing this in Windows XP Pro with the licenced
>Enterprise version of VNC?
Since I return the Process Id (PID) of the VNCViewer launch, I can use
the following Win32 code to close the process when I like :-
int vncpid=mjwinrun("vncviewer "+Socket->RemoteAddress,false);
Sleep(9999); // let it run for 10 seconds and then kill it...
if (!hProcess) ShowMessage("Could not OpenProcess\n"+mjgetlasterror());
if (TerminateProcess(hProcess,0)) ShowMessage("Terminated
else ShowMessage("Could not Terminate VNC\n"+mjgetlasterror());
Problem solved - thanks everybody.