CSh*_*ned 3 c# windows-ce .net-3.5
希望这个问题能得到解答.基本上我试图从我创建的应用程序中打开一个可执行文件,该应用程序在使用.net紧凑框架3.5的unitech条形码扫描器上的windows ce5上运行.我在这里尝试了一段代码.
每次我通过VS2008调试应用程序时,我都会收到Win32Exception,但没有进一步的细节(有或没有try catch语句).它没有告诉我异常是什么,也没有提供错误代码.
这是我用来尝试启动该过程的代码.你能看到任何可能导致错误的错误吗?我有双重和三重检查文件名以及它存储的目录,所以它不是那样.
private void CustomButtonEvent(object sender, EventArgs e)
{
string buttonName = ((Control)sender).Name;
ProcessStartInfo processStartInfo = new ProcessStartInfo();
buttonName = buttonName.Remove(0, 3);
buttonName = buttonName.Replace(' ', '_');
switch (buttonName)
{//todo need to open the different exe's here
case "End_Of_Line":
{
MessageBox.Show(@"No app behind this button yet.");
break;
}
case "Asset_Tracking":
{
processStartInfo.FileName = "AssetTrackingScanner.exe";
processStartInfo.WorkingDirectory = @"\Flash Storage\CompoundingManagementScannerSuite\Applications\AssetTrackingScanner\AssetTrackingScanner\bin\Debug";
try
{
Process.Start(processStartInfo);
}
catch (Exception f)
{
MessageBox.Show(f.ToString());
}
break;
}
case "Stock Take":
{
MessageBox.Show(@"No app behind this button yet.");
break;
}
case "Despatch":
{
MessageBox.Show(@"No app behind this button yet.");
break;
}
}
}
Run Code Online (Sandbox Code Playgroud)
我看到两个问题.首先,CE需要完全合格的路径,所以processStartInfo.FileName应该是这样的
processStartInfo.FileName =
@"\Flash Storage\CompoundingManagementScannerSuite\Applications\AssetTrackingScanner\AssetTrackingScanner\AssetTrackingScanner.exe";
Run Code Online (Sandbox Code Playgroud)
其次,CE没有WorkingDirectory的概念,所以删除调用来设置它.
我也有点担心\bin\debug\你的路径.Studio不会部署到bin\debug\设备上的文件夹.它在PC上构建为一个,但在目标设备上,唯一的方法就是手动设置它.这使我认为您需要检查您的设备应用程序路径.
| 归档时间: |
|
| 查看次数: |
4976 次 |
| 最近记录: |