Start process
-
Hi, I start a process using the Process.Start method with appropriate arguments. I can see that the process is created. However, when I try to get a handler on the process's main window , I get 0. It seems to be because the process doesn't already have finished drawing itself. How can I resolve this problem ? Thanks !
p.f. Goudjo-Ako Bringing our energy together !
-
Hi, I start a process using the Process.Start method with appropriate arguments. I can see that the process is created. However, when I try to get a handler on the process's main window , I get 0. It seems to be because the process doesn't already have finished drawing itself. How can I resolve this problem ? Thanks !
p.f. Goudjo-Ako Bringing our energy together !
Hi Hope this will help you even if I had a feel that my way is stupid ...
bool GetHandle; GetHandle= false; // Wait for 100 MillliSecond Before Get the Handle int WaitingTime = 100; Process pr = Process.Start("NotePad.exe"); while (GetHandle) { if (pr.StartTime.Ticks <= (DateTime.Now.Ticks - WaitingTime)) { GetHandle = true; } } // Getting Handle ( as String just to know it's value ) MessageBox.Show (Handle.ToString());
Have a good day ....I know nothing , I know nothing
-
Hi Hope this will help you even if I had a feel that my way is stupid ...
bool GetHandle; GetHandle= false; // Wait for 100 MillliSecond Before Get the Handle int WaitingTime = 100; Process pr = Process.Start("NotePad.exe"); while (GetHandle) { if (pr.StartTime.Ticks <= (DateTime.Now.Ticks - WaitingTime)) { GetHandle = true; } } // Getting Handle ( as String just to know it's value ) MessageBox.Show (Handle.ToString());
Have a good day ....I know nothing , I know nothing
I'm going to try ur suggestion. There's no stupid idea ! never ! Thanks a lor for helping. I'll be back with comments.
p.f. Goudjo-Ako Bringing our energy together !
-
Hi Hope this will help you even if I had a feel that my way is stupid ...
bool GetHandle; GetHandle= false; // Wait for 100 MillliSecond Before Get the Handle int WaitingTime = 100; Process pr = Process.Start("NotePad.exe"); while (GetHandle) { if (pr.StartTime.Ticks <= (DateTime.Now.Ticks - WaitingTime)) { GetHandle = true; } } // Getting Handle ( as String just to know it's value ) MessageBox.Show (Handle.ToString());
Have a good day ....I know nothing , I know nothing
Since you start by intializing GetHandle to false, we'll never enter in the while loop. No ?
p.f. Goudjo-Ako Bringing our energy together !
-
Since you start by intializing GetHandle to false, we'll never enter in the while loop. No ?
p.f. Goudjo-Ako Bringing our energy together !
-
yeah yeah you right x10 , sorry I just write it fast , you can fix the loop right ? and may be you can use for (int i =0 ; i<= 1000 ; i++) { Application.DoEvents(); } it's just about the idea , agree ?
I know nothing , I know nothing
Yeah, you're right ! What about the following little modification of your first code ? bool getHandle = true; int waitingTime = 300; while (getHandle) { if (InterProcCommunication.CurrentProcess.StartTime.Ticks <= (DateTime.Now.Ticks - waitingTime)) { getHandle = true; } else { getHandle = false; }
p.f. Goudjo-Ako Bringing our energy together !
-
yeah yeah you right x10 , sorry I just write it fast , you can fix the loop right ? and may be you can use for (int i =0 ; i<= 1000 ; i++) { Application.DoEvents(); } it's just about the idea , agree ?
I know nothing , I know nothing
We can also use Thread.Sleep(time);
p.f. Goudjo-Ako Bringing our energy together !
-
Hi, I start a process using the Process.Start method with appropriate arguments. I can see that the process is created. However, when I try to get a handler on the process's main window , I get 0. It seems to be because the process doesn't already have finished drawing itself. How can I resolve this problem ? Thanks !
p.f. Goudjo-Ako Bringing our energy together !
Uhhh...Instead of going through the timer garbage, which can be unreliable depending on system load, why not just do it in a single line of code?
Process newProc = Process.Start(newProcessInfo);
newProc.WaitForInputIdle();A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Uhhh...Instead of going through the timer garbage, which can be unreliable depending on system load, why not just do it in a single line of code?
Process newProc = Process.Start(newProcessInfo);
newProc.WaitForInputIdle();A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Uhhh...Instead of going through the timer garbage, which can be unreliable depending on system load, why not just do it in a single line of code?
Process newProc = Process.Start(newProcessInfo);
newProc.WaitForInputIdle();A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007This is interesting ! It does the same thing than using the Thread.Sleep(time) with a constant check of the handle on the process's main window, but in BETTER and MORE SIMPLE. Thanks !
p.f. Goudjo-Ako Bringing our energy together !