I have a very strange issue.
I have two application.
For example:
Process1.exe launching Process2.exe. (This is done using Process.WaitForExit(), Process1 will wait till Process2 gets closed.)
Sample code for this case.
- Process p = new Process();
- p.StartInfo.FileName = strFilePath;
- string strDirectory = System.IO.Path.GetDirectoryName(strFilePath);
- p.StartInfo.WorkingDirectory = strDirectory;
- p.Start();
- p.WaitForExit();
Now the Process2.exe is launching remote desktop using a pre-configured RDP(Remote Desktop Protocal) file.
This is done by using the below code.
- System.Diagnostics.Process remoteWindow = new System.Diagnostics.Process();
- remoteWindow.StartInfo.FileName = MSTSC_PROCESS_NAME;
- remoteWindow.StartInfo.Arguments = strUrl; // RDP file path
- remoteWindow.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
- result = remoteWindow.Start();
Now the issue is when we close the remote desktop window, focus is moving to Process1.exe. Actually windows should retain focus on Process2.exe
Also, this issue is not occuring in all kind of PC's. This issue is occurring specifically in Panasonic CF-C1 laptop.
OS: Windows 7
Is this a windows related issue? or Any suggestions will help.