0

I have some code that launches an EXE.

It works well on Windows XP but the application hangs when I run it on Windows 7 so I'm wondering if it's a security or authority issue.

        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)
    {

    }

Do you have any ideas for how to fix it, like how to launch it as admin or something like that?

Owen Versteeg
  • 342
  • 2
  • 14
Sara S.
  • 1,365
  • 1
  • 15
  • 33
  • Just to check: did you try to run it "as administrator" , not from code but by right clicking on exe? – Tigran Nov 20 '11 at 10:01
  • @Shadow Wizard ::WinForm – Sara S. Nov 20 '11 at 10:04
  • 2
    So see this related question: [how to force my C# Winforms program run as administrator on any computer](http://stackoverflow.com/questions/3598824/how-to-force-my-c-sharp-winforms-program-run-as-administrator-on-any-computer) – Shadow The GPT Wizard Nov 20 '11 at 10:40

0 Answers0