Beispiel #1
0
        public void SetupTargetPid(int processId)
        {
            TargetPid      = processId;
            viewerProcess  = Process.GetProcessById(processId);
            viewer_process = OpenProcess(viewerProcess, ProcessAccessTypes.PROCESS_VM_READ | ProcessAccessTypes.PROCESS_QUERY_INFORMATION);

            viewer_window_main = WndSearcher.SearchForWindowWithPid(viewerProcess.Id);

            // Find all the subwindow by control ID
            viewer_button_parent = GetDlgItem(viewer_window_main, VIEWER_BUTTON_PARENT_CODE);
            viewer_button_first  = GetDlgItem(viewer_button_parent, VIEWER_BUTTON_FIRST_CODE);
            viewer_button_next   = GetDlgItem(viewer_button_parent, VIEWER_BUTTON_NEXT_CODE);
            viewer_button_zoom   = GetDlgItem(viewer_button_parent, VIEWER_BUTTON_ZOOM_CODE);
            viewer_area_parent   = GetDlgItem(viewer_window_main, VIEWER_AREA_PARENT_CODE);
            viewer_area_main     = GetDlgItem(viewer_area_parent, VIEWER_AREA_MAIN_CODE);

            // Note: I tried to read status bar that displaying page number,
            // but looks like its text is hidden. So no auto page detection for now
#if false
            HWND statusBarHwnd = GetDlgItem(viewer_window_main, STATUS_BAR);
            m_ViewerStatusBar = new Win32StatusBar(viewer_process, statusBarHwnd);

            int panels = m_ViewerStatusBar.GetPanelCount( );
            for (int i = 0; i < panels; i++)
            {
                string caption = m_ViewerStatusBar.GetCaption(i);
                Debug.Print($"caption {i} = {caption}");
            }
#endif
        }
Beispiel #2
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 #3
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
            }
        }