2011-04-06 72 views
1

我是White的新手。有人可以告诉我如何运行一个exe文件(使用日志密码)并打印该exe文件中的所有元素?c#白色框架 - 代码项目

我没有使用

Application application = Application.Launch("exe /password)" 

,但它无法正常工作。

+4

什么是白色的项目? – Oded 2011-04-06 14:18:43

+0

白色项目是源代码不被盗用或从其他代码复制的项目:-)我猜 – 2011-04-06 14:21:17

+8

白色是一个基于Win32,WinForms,WPF,Silverlight和SWT(Java)平台的自动化富客户端应用程序的框架。它基于.NET,不需要使用任何专有脚本语言 – 2011-04-06 14:21:23

回答

1

Elisa 我假设你想从包含listview或gridview的表单中获取电话号码并将它们写入文件或其他控件。所以我的头顶部的:)这里有云

//启动该应用

应用程序= Application.Launch(“.exe文件的完整路径”);

//启动应用程序

窗WIN = app.GetWindow(Core.UIItems.Finders.SearchCriteria.ByAutomationId( “Form1的”),Core.Factory.InitializeOption.NoCache)后获得的主窗口;

//获取列表/ GRIDVIEW类型的表及其在白

变种listOfPhonesNumbers = win.Get < Table>(SearchCriteria.ByAutomationId( “grdPhoneNumber”));

的for(int i = 0; i “的<” listOfPhoneNumbers.Rows.Count;我++){ /// 印刷的电话号码,任何文件 }

0
#region lanch App 
// source exe file path. here it is calculator exe path 
const string ExeSourceFile = @"C:\Windows\system32\calc.exe"; 
//Global Variable to for Application launch 
White.Core.Application _application; 
//Global variable to get the Main window of calculator from application. 
White.Core.UIItems.WindowItems.Window _mainWindow; 
//start process for the above exe file location 
var psi = new ProcessStartInfo(ExeSourceFile); 
// launch the process through white application 
_application = White.Core.Application.AttachOrLaunch(psi); 
//Get the window of calculator from white application 
_mainWindow = _application.GetWindow 
(SearchCriteria.ByText("Calculator"), InitializeOption.NoCache); 
#endregion