public static InfoTips_3C GetInfoTipWindow(int processId) { InfoTips_3C current = null; NativeApi.EnumWindows((hwnd, lparam) => { uint currentProcessId = 0; NativeApi.GetWindowThreadProcessId(hwnd, out currentProcessId); if (currentProcessId == processId) { StringBuilder title = new StringBuilder(256); int len = NativeApi.GetWindowText(hwnd, title, 255); if (title.ToString().StartsWith("信息提示")) { current = new InfoTips_3C(hwnd); return(false); } } return(true); }, IntPtr.Zero); if (current != null) { current.InitHandle(); } return(current); }
public static FillDialog_3C GetFillDialog(string type, IntPtr owner, uint processId) { IntPtr hwnd = IntPtr.Zero; FillDialog_3C current = null; if (type == CCCWindowType.AttachWindow) { current = GetAttachWindow(processId); } else if (type == CCCWindowType.SaveWindow) { current = GetSaveDialog(processId); } else { do { System.Threading.Thread.Sleep(500); hwnd = GetWindowHandle(owner, processId); switch (type) { case CCCWindowType.AddWindow: current = new AddWindow(hwnd); break; case CCCWindowType.FirmWindow: current = new SelectFirmRelation_3C(hwnd); break; case CCCWindowType.InfoTipWindow: current = new InfoTips_3C(hwnd); break; case CCCWindowType.InputFileNameWindow: current = new InputFileName_3C(hwnd); break; case CCCWindowType.ListCheckBoxWindow: current = new CheckListBox_3C(hwnd); break; case CCCWindowType.LoginWindow: current = new Login_3C(hwnd); break; case CCCWindowType.MultiValueAndNote: current = new AddValueAndNote(hwnd); break; case CCCWindowType.OpenFileWindow: current = new OpenFileDialog_3C(hwnd); break; case CCCWindowType.PropertyWindow: current = new SelectProperty_3C(hwnd); break; case CCCWindowType.RadioWindow: current = new RadioButtonWindow(hwnd); break; case CCCWindowType.TextWindow: current = new TextEditWindow(hwnd); break; case CCCWindowType.ColumnWindow: current = new ColumnWindow(hwnd); break; } if (current != null) { current.InitHandle(); } } while (_run && (hwnd == IntPtr.Zero || current == null || current.IsValidWindow() == false)); } return(current); }