Пример #1
0
        private bool EnsureMREditWindows()
        {
            try
            {
                int childAfter = 0;
                int subPanel = 0;
                int tmpEdit = 0;
                WINDOWINFO wInfo = new WINDOWINFO();
                TextEdit[] tmpEdits = new TextEdit[3];

                if (EnsureMRWindow())
                {
                    while (true)
                    {
                        editPanel = msg.getWindowIdEx(topWindow, childAfter, "TPanel", null);
                        if (editPanel == 0)
                            break;
                        childAfter = editPanel;
                        subPanel = msg.getWindowIdEx(editPanel, 0, "TPanel", "0");
                        if (subPanel != 0)
                            break;
                    }
                    int i = 0;
                    while (true)
                    {
                        tmpEdit = msg.getWindowIdEx(editPanel, tmpEdit, "TEdit", null);
                        if (tmpEdit == 0)
                            break;
                        else
                        {
                            wInfo = msg.getWindowInfo(tmpEdit);
                            {
                                tmpEdits[i].hWnd = tmpEdit;
                                tmpEdits[i].Xpos = wInfo.rcClient.Left;
                                i++;
                            }
                        }
                    }

                    if (tmpEdits[0].Xpos < tmpEdits[1].Xpos)
                    {
                        edits[0] = tmpEdits[0];
                        edits[1] = tmpEdits[1];
                        edits[2] = tmpEdits[2];
                    }
                    else
                    {
                        edits[0] = tmpEdits[2];
                        edits[1] = tmpEdits[1];
                        edits[2] = tmpEdits[0];
                    }

                    return true;
                }
                else
                    return false;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Morse Runner not running?\n" + ex.ToString());
                return false;
            }
        }
Пример #2
0
 private static extern bool GetWindowInfo(int hwnd, ref WINDOWINFO winfo);
Пример #3
0
        /*
        public int getHandle(string exe_name)  // writen by S56A, ex-maintenance engineer
        {
            using System.Diagnostics;

            Process[] procs = Process.GetProcesses();
            IntPtr hWnd;
            int ret = 0;
            foreach (Process proc in procs)
            {
                if (((hWnd = proc.MainWindowHandle) != IntPtr.Zero) && (proc.ProcessName.Contains(name)))
                {
                    ret =  hWnd;
                }
            }
            return ret;
        }
        */
        public WINDOWINFO getWindowInfo(int hwnd)
        {
            WINDOWINFO Winfo = new WINDOWINFO();
            GetWindowInfo(hwnd, ref Winfo);
            return Winfo;
        }
Пример #4
0
 private static extern bool GetWindowInfo(int hwnd, ref WINDOWINFO winfo);