Interop.SHDOCVW.DLL

Last post 10-13-2009 3:14 AM by parny003. 6 replies.

Sort Posts:

  • Interop.SHDOCVW.DLL

    07-25-2007, 2:10 AM

    I have added reff of shodovw.dll in my web application.

    Then I created the object of shell windows . When ever this object is created it gives error "Not enough memory space".

    Please let me know where I am going wrong.

  • Re: Interop.SHDOCVW.DLL

    07-25-2007, 5:29 AM

    You might have to manually do GC dispose. Lets see your code.

    Please Mark Post that helped you as answer, also include a summary of what solved the problem as it helps others in similar situations
  • Re: Interop.SHDOCVW.DLL

    07-26-2007, 7:54 AM
    • Member
      4 point Member
    • shubhams
    • Member since 07-26-2007, 11:42 AM
    • Posts 2

    Actully my main issue is I want to know the url of all the windows open in the client's machine. For this purpose I am using shdocvw.dll.

    I have written this code : 

     

    public String executeMSIE()

    {

    StringBuilder sb = new StringBuilder();IShellWindows sh = new ShellWindows();

     

    IEnumerator en = sh.GetEnumerator();

     

    IWebBrowser2 ie;

    IHTMLDocument2 doc;

    while(en.MoveNext())

    {

    ie = (IWebBrowser2)en.Current;

    if (ie != null)

    {

    doc = (IHTMLDocument2)ie.Document;

     

    if (doc != null)

    {

    sb.Append(doc.url);

    sb.Append("<BR>");

    }

    }

    }

    if (sb != null)

    return sb.ToString();

    else

    return "No MSIE windows?";

     }

    This works fine in windows application. But when we map project folder to of this windos application to IIS and through HTML file we create object of above mentioned class and access the above function it gives security exception.

    Above function is in PrefillUtility class

     

    I create object of above class using this code:

    <object id="PrefillLibrary1" height="250" width="500" classid="http:PrefillLibrary.dll#PrefillLibrary.PrefillUtility" VIEWASTEXT>

     

    Rest of the funtions are working fine.

    Please let me know how to implement this . Is there any work around?

    If I use the same shdocvw,dll in web application then

    IShellWindows sh = new ShellWindows();

     

    gives out of memory exception.

  • Re: Interop.SHDOCVW.DLL

    07-26-2007, 8:54 AM

    Could you send me an email wiht your project and instructions of deplying..I will have a look. naturehermit@                    (anywebmailyouuse)

    Please Mark Post that helped you as answer, also include a summary of what solved the problem as it helps others in similar situations
  • Re: Interop.SHDOCVW.DLL

    07-26-2007, 9:04 AM

    The other thing is IShellWindows is a com object and as far as I know cannot be used in web applications. Its not been tested. I cannot find the documentation. This is supposed to be used in native environment.

    Please Mark Post that helped you as answer, also include a summary of what solved the problem as it helps others in similar situations
  • Re: Interop.SHDOCVW.DLL

    07-27-2007, 1:34 AM
    • Member
      4 point Member
    • shubhams
    • Member since 07-26-2007, 11:42 AM
    • Posts 2

    Following are the steps to deploy

     1>Create a new class library(name it as "PrefillLibrary") in visual studio .net.

    2>Add reff to Shdocvw.dll and Microsoft.mshtml

    3>Change name of class1.cs to PrefillUtility.cs.

    Add these lines: 

     using mshtml;

    using SHDocVw;

    4>Add following function in that class.

    public String executeMSIE()
      {
       StringBuilder sb = new StringBuilder();
       IShellWindows sh = new ShellWindows();
       
       IEnumerator en = sh.GetEnumerator();
       
       IWebBrowser2 ie;
       IHTMLDocument2 doc;   
       while(en.MoveNext())
       {
        ie = (IWebBrowser2)en.Current;
        if (ie != null)
        {
         doc = (IHTMLDocument2)ie.Document;
         
         if (doc != null)
         {
          sb.Append(doc.url);
          sb.Append("<BR>");
         }
        }
       }

       if (sb != null)
        return sb.ToString();
       else
        return "No MSIE windows?";
      }

    5>Add a HTML page to the class library


    6>Place this HTML in bin directory of ur project.

    7>Add following code in HTML. inside <HTML> tag:

    <head>
      <script language="javascript">
      
      function runExecuteMSIE()
      {
       var temp = PrefillLibrary1.executeMSIE();
       alert(temp);
       
      } 
      
      </script>
     </head>
     <body>
      <p>Prefill Library<br>
       <br>
       <OBJECT id="PrefillLibrary1" height="250" width="500" classid="http:PrefillLibrary.dll#PrefillLibrary.PrefillUtility"
        VIEWASTEXT>
       </OBJECT>
       <br>
       <input type="button" value="Execute MSIE" onclick="runExecuteMSIE()">
       <br>
       <br>
      </p>
     </body>

     

    8>Map the whole project folder to IIS.

    9>Browse the HTML Page from IIs.

    After this I am getting the exception "Permission denied".
    Please let me know if there is any alternatiove for this. My main purpose is to get all the URLs running on the client's machine.


     

  • Re: Interop.SHDOCVW.DLL

    10-13-2009, 3:14 AM
    • Member
      6 point Member
    • parny003
    • Member since 06-25-2009, 2:23 AM
    • Posts 20

    Hi Shubhams,

    Did you manage to get it worked?  Can you help me to resolve my similar problem? however I have windows service ionstead of web application?

    Thanking you.

Page 1 of 1 (7 items)