Windows 7上的启动进程/ EXE挂起

时间:2011-11-20 09:54:37

标签: c# windows-7 process

我有一些启动EXE的代码。

它在Windows XP上运行良好,但是当我在Windows 7上运行它时应用程序挂起,所以我想知道它是否是安全或权限问题。

        MessageSender msg = new MessageSender();
        int result = 0;
        int hWnd = msg.getWindowId(null, " Sending");
        if (hWnd == 0)
        {
            Process notePad = new Process();
            notePad.StartInfo.FileName = Application.StartupPath + @"\" + "SendingGeneratedSeries.exe";
            if (!File.Exists(notePad.StartInfo.FileName))
            {
                PXMessageBox.ShowBox("This service is not installed yet.", "Warning", PXMessageBox.OKMode);
                return;
            }
            notePad.Start();
            int counter = 0;
            while (hWnd == 0 && counter < 10000000)
            {
                hWnd = msg.getWindowId(null, " Sending");
                counter++;
            }
            if (hWnd != 0)
                result = msg.sendWindowsStringMessage(hWnd, 0, Path.GetTempPath() + @"\" + "Images" + @"\" + path + "," + branchinfo.IP + "," + branchinfo.port.ToString() + "," + branchinfo.AE + "," + StudyInfoList[studyindex].patNameEng);
        }
        else
        {
            result = msg.sendWindowsStringMessage(hWnd, 0, Path.GetTempPath() + @"\" + "Images" + @"\" + path + "," + branchinfo.IP + "," + branchinfo.port.ToString() + "," + branchinfo.AE + "," + StudyInfoList[studyindex].patNameEng);
        }
    }
    catch (Exception ex)
    {

    }

您对如何修复它有什么想法,比如如何以管理员或类似方式启动它?

0 个答案:

没有答案
相关问题