当前位置:编程学习 > wap >>

我有个WINCE程序,退出时候无法关闭扫描程序

我有个WINCE程序,要求打开时候启动扫描程序,退出时候关闭扫描程序,代码如下,大家知道什么原因吗?模拟器里没有问题,实机上,就关不掉扫描程序。

打开:
           Dim proc As Process = New Process()
            proc.StartInfo.FileName = CommonConst.SCAN_APP_PATH
            proc.Start()
            '记忆扫描程序进程ID
            CommonUtil.ScanWedgeId = proc.Id.ToString()

关闭:
        If Not String.IsNullOrEmpty(CommonUtil.ScanWedgeId) Then
            Try
                '通过ID获取扫描程序进程
                Dim proc As Process = Process.GetProcessById(CInt(CommonUtil.ScanWedgeId))
                proc.Kill()
            Catch ex As Exception
                CommonUtil.SetErrorLog("", ex.Message, ex.StackTrace)
            End Try
        End If

打开及关闭都有异常,异常内容:
[3/17/2011 9:57:13 AM]:An error message is available for this exception but cannot be displayed because these messages are optional and are not currently installed on this device. Please install 慛ETCFv35.Messages.EN.wm.cab?for Windows Mobile 5.0 and above or  慛ETCFv35.Messages.EN.cab?for other platforms. Restart the application to see the message.(ID:)
   at System.Diagnostics.Process.GetProcessById(Int32 processId)
   at TysonLabel.FmLogin.CloseScanWedge()
   at TysonLabel.FmLogin.DoFunc(String key)
   at TysonLabel.FmLogin.btnExit_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.ButtonBase.WnProc(WM wm, Int32 wParam, Int32 lParam)
   at System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam, Int32 lParam)
   at Microsoft.AGL.Forms.EVL.EnterMainLoop(IntPtr hwnMain)
   at System.Windows.Forms.Application.Run(Form fm)
   at TysonLabel.StartupModule.Main()

[3/17/2011 9:59:58 AM]:Win32Exception(ID:)
   at System.Diagnostics.Process.Kill()
   at TysonLabel.FmLogin.CloseScanWedge()
   at TysonLabel.FmLogin.FmLogin_Closing(Object sender, CancelEventArgs e)
   at System.Windows.Forms.Form.OnClosing(CancelEventArgs e)
   at System.Windows.Forms.Form._FCanClose()
   at System.Windows.Forms.Form.WnProc(WM wm, Int32 wParam, Int32 lParam)
   at System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam, Int32 lParam)
   at Microsoft.AGL.Forms.EVL.EnterMainLoop(IntPtr hwnMain)
   at System.Windows.Forms.Application.Run(Form fm)
   at TysonLabel.StartupModule.Main() --------------------编程问答-------------------- 没有安装相应的.NET包 --------------------编程问答-------------------- 装了,还是不能kill,难道scanWedge.exe有保护进程被其他进程关闭的功能?
那位知道,请指教。
我的手持端是mc9090 CR

[2011-3-17 14:52:56]:Win32Exception(ID:)
位于 System.Diagnostics.Process.Kill()
位于 TysonLabel.FmLogin.CloseScanWedge()
位于 TysonLabel.FmLogin.DoFunc(String key)
位于 TysonLabel.FmLogin.btnExit_Click(Object sender, EventArgs e)
位于 System.Windows.Forms.Control.OnClick(EventArgs e)
位于 System.Windows.Forms.Button.OnClick(EventArgs e)
位于 System.Windows.Forms.ButtonBase.WnProc(WM wm, Int32 wParam, Int32 lParam)
位于 System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam, Int32 lParam)
位于 Microsoft.AGL.Forms.EVL.EnterMainLoop(IntPtr hwnMain)
位于 System.Windows.Forms.Application.Run(Form fm)
位于 TysonLabel.StartupModule.Main()

--------------------编程问答-------------------- 没人知道吗? --------------------编程问答-------------------- 楼主,不知道你扫描程序不能退出的问题解决没。 --------------------编程问答-------------------- 可能是你的扫描线程写的有问题
补充:移动开发 ,  Windows Phone
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,