Beispiel #1
0
 private bool getLoLWindow()
 {
     hWnd = WndSearcher.SearchForWindow("", "League of Legends");
     if (hWnd != IntPtr.Zero)
     {
         GetWindowRect(hWnd, ref wRect);
         //SetForegroundWindow(hWnd);
         logger.Debug("Located LOL Window : (" + wRect.Left.ToString() + "," + wRect.Top.ToString() + ")");
         return(true);
     }
     return(false);
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            try
            {
                CCHMIRUNTIME.HMIRuntime rt = new CCHMIRUNTIME.HMIRuntime();
                rt.Stop();

                System.Threading.Thread.Sleep(500);
            }
            catch (Exception exc)
            {
                string ex = exc.Message;
            }
            finally
            {
                var    anyPopupClass     = "#32770"; //usually any popup
                IntPtr deactivatingPopup = WndSearcher.SearchForWindow(anyPopupClass, "Deactivating -");
                do
                {
                    deactivatingPopup = WndSearcher.SearchForWindow(anyPopupClass, "Deactivating -");
                    System.Threading.Thread.Sleep(500);
                } while (deactivatingPopup != IntPtr.Zero);

                System.Threading.Thread.Sleep(5000);

                //System.Diagnostics.Process.Start(@"cscript //B //Nologo C:\Program Files (x86)\Siemens\WinCC\bin\Reset_WinCC.vbs");
                Process scriptProc = new Process();
                scriptProc.StartInfo.FileName         = @"cscript";
                scriptProc.StartInfo.WorkingDirectory = @"C:\Program Files (x86)\Siemens\WinCC\bin\"; //<---very important
                scriptProc.StartInfo.Arguments        = "//B //Nologo Reset_WinCC.vbs";
                scriptProc.StartInfo.WindowStyle      = ProcessWindowStyle.Hidden;                    //prevent console window from popping up
                scriptProc.Start();
                scriptProc.WaitForExit();                                                             // <-- Optional if you want program running until your script exit
                scriptProc.Close();
                //System.Diagnostics.Process.Start(@"C:\Program Files (x86)\Siemens\WinCC\bin\CCCleaner.exe", "-terminate"); //not working uac
            }
        }