Re: Exception launcing processes



Sorry, you're right, but I trusted on goodness of emulator (what a
stupid!!). Next time I'll be more careful on details.

Andrea

Paul G. Tobey [eMVP] ha scritto:

I'm sure that my other response is right, then. We ***NEED TO KNOW*** when
you're claiming some behavior and it's on the emulator, too. That's
critical information!

Paul T.

<andrerus@xxxxxxxxx> wrote in message
news:1161367491.596160.310330@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I tried to reset emulator and now no exception occur. I suppose that
was related to the process managing of emulator.

Andrea

andrerus@xxxxxxxxx ha scritto:

Here are exception details:

System.InvalidOperationException was unhandled
Message="InvalidOperationException"
StackTrace:
at System.Diagnostics.Process.EnsureState()
at System.Diagnostics.Process.get_MainWindowHandle()
at MyApp.MyApp.LaunchApp()
at MyApp.MyApp.Start()
at MyApp.MyApp.startStop_Click()
at System.Windows.Forms.Control.OnClick()
at System.Windows.Forms.Button.OnClick()
at System.Windows.Forms.ButtonBase.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at OpenNETCF.Windows.Forms.NativeMethods.DispatchMessage()
at OpenNETCF.Windows.Forms.Application2.Pump()
at OpenNETCF.Windows.Forms.Application2.RunMessageLoop()
at OpenNETCF.Windows.Forms.Application2.Run()
at MyApp.Program.Main()

Thanks,

Andrea


Paul G. Tobey [eMVP] ha scritto:

OK, sorry. The text of the exception?

Paul T.

<andrerus@xxxxxxxxx> wrote in message
news:1161332625.534426.64880@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Probabibly I should be explicit, however I'm developing for Mobile,
this code is fulli supported by WinCE.

Andrea

Paul G. Tobey [eMVP] ha scritto:

You realize that you posted this to a Windows CE, not a Windows
desktop,
group? I think you'll have a better chance of getting good help in
a
more-appropriate group.

Paul T.

<andrerus@xxxxxxxxx> wrote in message
news:1161297371.890676.30520@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi, I'd like understanding why, when I launch a process from
inside my
application I receive or no an exception, depending on the program
I
try to launch. This is the code I execute:

externApp = System.Diagnostics.Process.Start(fullnameApp, "");

IntPtr hwndExt = IntPtr.Zero;
do
{
System.Threading.Thread.Sleep(500);
externApp.Refresh();
hwndExt = externApp.MainWindowHandle; //this line throws
InvalidOperationException
}
while (hwndExt.Equals(IntPtr.Zero));

If fullnameApp = "/Windows/calc.exe", no exception occurr,
if instead fullnameApp = "/Windows/iexplore.exe" exception is
thrown.

Analising both cases with debugging before executing the impeached
line
I saw that in first case it has exited field and HasExited
property =
false, instead in the latter, in a first moment exited field is
false
and HasExited true, but then both became true, even if the process
is
still alive.

Which is the reason of it?

Thanks,
Andrea




.