shdoc error

Class library usage, coding and language questions.
regex
Posts: 48
Joined: Tue Aug 14, 2012 5:47 pm

shdoc error

Post by regex » Fri Sep 07, 2012 9:44 pm

Here is an error that I get when using the reference to the DLL SHDocVw on a 64 bit windows 7 machine during impelmentation of this block of code:

Code: Select all

public static void WaitIECtrl()
		{			
			while (IE.Busy && IE.Visible)
			{
				System.Threading.Thread.Sleep(500);
			}
			
			WriteToReportType("Info", "Waited for Internet Explorer Control...");
		}


Unexpected exception occured: System.Runtime.InteropServices.COMException (0x800706B5): The interface is unknown. (Exception from HRESULT: 0x800706B5)
at SHDocVw.InternetExplorerClass.get_LocationURL()
at StartIE() in Code.cs:line 285

It says that it bombs at line 85 which is this code:

urlStr = IE.LocationURL.ToString();

From this code block:

Code: Select all

public static bool StartIE()
		{
			object misValue = new object();
			string[] logStatusStr = {"Successful", "Failed"};
			string logOnPortalStr = string.Format(PortalLogInURL.ToString(), StackPortal.ToString());
			string urlStr = string.Empty;
			string logStr = "IE Status: ";
			bool rtnStatus = false;
			
			try 
			{
				IE = new SHDocVw.InternetExplorerClass();
				IE.Navigate(logOnPortalStr, ref misValue, ref misValue, ref misValue, ref misValue);
				IE.Visible = true;			
				
				while (IE.Busy)
				{
				    System.Threading.Thread.Sleep(500);
				}
				
				Ranorex.Delay.Seconds(1);
				
				urlStr = IE.LocationURL.ToString();				
				
				if (urlStr == logOnPortalStr)
				{
					logStr += logStatusStr[0];
					rtnStatus = true;
				}	
				else
				{
					logStr += logStatusStr[1];
				}
				
				WriteToReportType("Info", logStr);
				
				return rtnStatus;
			}
			
			catch (Exception e) 
            {
				WriteToReportType("Failure", "Unexpected exception occured: " + e.ToString());
			 	return false;			 	
			}
		}

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

Re: shdoc error

Post by Support Team » Mon Sep 10, 2012 5:23 pm

Hello,

It seems to be an error within your DLL. Which version of Internet Explorer do you use?
Please try to set the check box "Enable Protected Mode" in the Internet Explorer properties.
Tools -> Internet Options -> Security -> "Enable Protected Mode".

I found some other solutions in another forum: http://stackoverflow.com/questions/1014 ... 8-with-ie8
Maybe there is a solution for you.

Regards,
Bernhard
Ranorex Support Team