Exemplo n.º 1
0
        public static void FileSave(IntPtr appHwnd, string fileName)
        {
            NativeAPI.PostMessage(appHwnd, NativeAPI.WM_COMMAND, 4, IntPtr.Zero);
            Thread.Sleep(1000);
            var tmpWndClass = "#32770";
            var tmpHwnd     = NativeAPI.FindWindowEx(IntPtr.Zero, IntPtr.Zero, tmpWndClass, null);
            var dlgOpenHwnd = tmpHwnd;

            tmpWndClass = "ComboBoxEx32";
            tmpHwnd     = NativeAPI.FindWindowEx(tmpHwnd, IntPtr.Zero, tmpWndClass, null);
            tmpWndClass = "ComboBox";
            var fileNameEditHwnd = NativeAPI.FindWindowEx(tmpHwnd, IntPtr.Zero, tmpWndClass, null);

            tmpWndClass      = "Edit";
            fileNameEditHwnd = NativeAPI.FindWindowEx(fileNameEditHwnd, IntPtr.Zero, tmpWndClass, null);
            AppAutomationHelper.SendText(fileNameEditHwnd, fileName);
            Thread.Sleep(100);
            NativeAPI.SendMessage(dlgOpenHwnd, NativeAPI.WM_COMMAND, 1, IntPtr.Zero);
        }
Exemplo n.º 2
0
 public static IntPtr FindWindow(string wndClass, string wndCaption)
 {
     return(NativeAPI.FindWindowEx(IntPtr.Zero, IntPtr.Zero, wndClass, wndCaption));
 }