What's different in the process environment when toggling ProcessStartInfo.CreateNoWindow?

48 Views Asked by At

I have a C# program invoking another program using Process.Start and ProcessStartInfo:

ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "myOtherProgram.exe";
startInfo.CreateNoWindow = true; // bad boy here
startInfo.UseShellExecute = false;

Process process = new Process();
process.StartInfo = startInfo;
process.Start();
process.WaitForExit();

The weird part is "myOtherProgram.exe" takes about 25s for CreateNoWindow=true, and only 2s for CreateNoWindow=false. Starting "myOtherProgram.exe" from command prompt is only 2s too. For what I can tell the hiccup is starting the particular exe. Starting "C:\Windows\System32\where.exe" instead from my program works without a hitch.

Q: So, what the differences between having CreateNoWindow true or false as seen by the started process?


"myOtherProgram.exe" is a corporate internal (confidental, IP) abandonware based on unfamiliar third party components. The development environment is busted. I'm debugging it the best I can, but hoping any answer to the more general question can point me in the right direction. Cannot provide much more debugging details at this time.


I've located the culprit in "myOtherProgram":

imaqSetWindowThreadPolicy(IMAQ_SEPARATE_THREAD);

Determines the thread in which NI Vision creates windows. By default, NI Vision uses IMAQ_CALLING_THREAD. This policy creates windows in the thread that makes the first display function call for a given window number. If that thread does not process messages, set the window thread policy to IMAQ_SEPARATE_THREAD. Using this policy, NI Vision creates windows in a separate thread and processes messages for the windows automatically.

I'll open a ticket with NI and see what they have to say for themselves. Why of course our service agreement expired long ago because deserving good things is not my game. Dead end.

0

There are 0 best solutions below