Cannot launch Window Explorer (StartWindowsApplication)

Class library usage, coding and language questions.
andylee
Posts: 4
Joined: Tue Aug 19, 2008 1:42 pm

Cannot launch Window Explorer (StartWindowsApplication)

Post by andylee » Thu Aug 28, 2008 4:48 pm

Hi there,

I've tried launching Window Explorer (Windows XP SP2)

Ranorex.Application.StartWindowsApplication("C:\\WINDOWS\\explorer.exe", "C:\\", 5000);

but I'm constantly getting a System.InvalidOperationException (see debug).

Cheers,
Andy


2008-08-28 16:42:30.137 [ERROR] [default]: FAIL: auth6
2008-08-28 16:43:11.058 [ERROR] [default]: System.InvalidOperationException: Process has exited, so the requested information is not available.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.get_ProcessName()
at Ranorex.Application.GetMainWindowFromProcess(Process proc, Int32 timeout)
at Ranorex.Application.StartWindowsApplication(String fileName, String arguments, Int32 timeout)

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Post by Support Team » Fri Aug 29, 2008 9:01 am

The problem with Windows Explorer is that be default there may only be a single explorer.exe process. So, if you try to start another explorer.exe process using the Ranorex.Application.StartWindowsApplication method, the newly started explorer process will inform the singleton explorer process to spawn a new window and will then immediatly exit.

You can change this behavior by changing the windows registry:
http://support.microsoft.com/kb/156366/

Regards,
Alex
Ranorex Support Team