public void SetUp() { //テスト用の画面起動 app = new WindowsAppFriend(Process.Start(Settings.TestApplicationPath)); testDlg = WindowControl.FromZTop(app); WindowsAppExpander.LoadAssemblyFromFile(app, GetType().Assembly.Location); }
public void TestExpandAssemblyFile() { WindowControl targetForm = WindowControl.FromZTop(app); WindowsAppExpander.LoadAssemblyFromFile(app, typeof(ExpandMethods).Assembly.Location); app[typeof(ExpandMethods), "SetText"]("xxx", targetForm.AppVar); Assert.AreEqual(targetForm["Text"]().ToString(), "xxx"); Assert.AreEqual((int)app[typeof(ExpandMethods), "GetDataValue"](new Data(3)).Core, 3); }
public void SetUp() { _app = new WindowsAppFriend(Process.Start("Target.exe")); _mainWindow = WindowControl.FromZTop(_app); dynamic win = _app.Type<Application>().Current.MainWindow; dynamic grid = win._grid; _target = _app.Type<ProgressBar>()(); grid.Children.Add(_target); WindowsAppExpander.LoadAssemblyFromFile(_app, GetType().Assembly.Location); }
public void TestLoadLibrary() { if (IntPtr.Size != 4) { return; } Assert.IsTrue(WindowsAppExpander.LoadLibrary(app, TargetPath.PathExpandNative)); WindowsAppExpander.LoadAssemblyFromFile(app, typeof(ExpandMethods).Assembly.Location); //ロードしたDLLからMFCのメッセージボックスを呼び出し、それを閉じる WindowControl current = WindowControl.FromZTop(app); app[typeof(ExpandMethods), "Func", new Async()]("xxx"); WindowControl next = current.WaitForNextModal(); WindowControl button2 = next.IdentifyFromZIndex(2); button2.SetFocus(); button2.SequentialMessage( new MessageInfo(0x0201, 0x0001, 0), new MessageInfo(0x0202, 0x0000, 0)); }
private void OnSelectApp(object sender, RoutedEventArgs e) { var dlg = new SelectAppWindow(); var ret = dlg.ShowDialog() ?? false; if (ret == true) { var pid = dlg.SelectedProcess.Process.Id; var process = Process.GetProcessById(pid); var app = new WindowsAppFriend(process); dynamic win = app.Type <Application>().Current.MainWindow; WindowsAppExpander.LoadAssemblyFromFile(app, GetType().Assembly.Location); var sb = (ControlInfo[])GetInvoker(app).Dump(win, _temporaryImageStoreFolder); Map = new Dictionary <ControlInfo, WirePolyline>(); ViewPort.Children.Clear(); var root = sb.First(); foreach (var c in sb) { var frame = CreateControlFrameView(c, root); Map.Add(c, frame); if (c.TexturePath != null) { if (c.Children.Count == 0) { var body = CreateControlBodyView(c, root); var body2 = CreateControlBodyView2(c, root); ViewPort.Children.Add(body); ViewPort.Children.Add(body2); } } ViewPort.Children.Add(frame); } Tree.ItemsSource = root.Children; } }