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);
  if (vncpid!=-1)
  {
    Sleep(9999); // let it run for 10 seconds and then kill it...
    HANDLE hProcess=OpenProcess(PROCESS_TERMINATE,TRUE,vncpid);
    if (!hProcess) ShowMessage("Could not OpenProcess\n"+mjgetlasterror());
    if (TerminateProcess(hProcess,0)) ShowMessage("Terminated 
Successfully");
    else ShowMessage("Could not Terminate VNC\n"+mjgetlasterror());
  }

Problem solved - thanks everybody.

-- 
Mark Jacobs
http://www.dkcomputing.co.uk
_______________________________________________
VNC-List mailing list
[email protected]
To remove yourself from the list visit:
http://www.realvnc.com/mailman/listinfo/vnc-list

Reply via email to