Execute GUI process and its child processes as hidden

I have been trying to automate VNC viewer process to connect the server and check whether it is active or not and save it in file. There is a list of servers that needs to be checked. For that I downloaded UltraVncViewer for this, developed a program to execute VncViewer via commandline by providing host and password as cmd args.

When the VncViewer connected, vncviewer window appears or when it is not connected, then a message box showing error pops up. How can start the process silently or in background hidden, so that I can work normally without popping that window.

Code I am using to start process. I need to make this work silently with hidden or no window. (I have used CreateNoWindow or Window Style hidden, but it is used for Console window, but I have GUI window. I have tried developing batch file which uses /B parameter to start process in background, but there is no way to provide commandline args dyanmically).


Process p = new Process();
            // Start the child process.

            p.StartInfo.ErrorDialog = false;
            p.StartInfo.CreateNoWindow = true;
            p.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
            p.StartInfo.FileName = @"UltraVNCvncviewer.exe";
            //StartInfo.CreateNoWindow = true;
            //StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
            string pass = serverinfo.Password;
            if (pass == null)
                p.StartInfo.Arguments = string.Format("-console -multi -nostatus -connect {0}"
                    , args);
                p.StartInfo.Arguments = string.Format("-console -multi -nostatus -connect {0} -password {1}"
                    , args, pass);

            string output = string.Empty;
            string s = string.Empty;

          //wait for the process to start
         if(p.MainWindowTitle.ToLower() == "vncviewer message box")
                return serverinfo.IsActive = false;
                return serverinfo.IsActive = true;

Any help?

Source: windows

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.