????? ??????? ???? ?????? WebBrowser ???? ??????? ?? Visual C# 2005 ?? ?? Visual C# .NET

?????? ????????? ?????? ?????????
???? ???????: 304662 - ??? ???????? ???? ????? ????? ??? ???????.
?????? ??? ????? Microsoft Visual Basic .NET ?? ??? ???????? ???? 304643.
????? ???? | ?? ????

?? ??? ??????

??????

????? ??? ?? ????? ????? Microsoft Office ??????? ?? ????? Microsoft Visual C#. ?? ???? Microsoft Visual C# 2005 ? Microsoft Visual C# .NET ???? ???? OLE ???? ???? ?? ????? ????? Office ?? ?????. ??? ??? ???? ?? ????? ????? ????? ???? ????? ????? ActiveX ?? ??? ???? ?? ????? Visual C# ?? ?????? ?? ??????? ???? ?????? WebBrowser Microsoft.

???? ??? ??????? ????? ??????? ??? ????? Office ????? ?????? ??? ???? ????? Visual C# ???????? ???? ?????? WebBrowser.

??????? ????

????????? ActiveX ?? ?????? OLE embeddable ?????? ???? ??? ????? ???? ActiveX ?? ?????? OLE ?????????. ???? ???? ???? ??????? ? ?? ??? ????? ????? ActiveX ?? ???? ?????? ??????? ?? ????? ????. ????? ?? ???? ??? ????? ?? ??? ????? ????? ??? ??? ??? (??? ?? Microsoft Internet Explorer) ?? ??? ??????? ?? ???? ???? ?? ????????? ?????? (??? ??? Microsoft Office Binder). ????? ActiveX ????????? ?? ???? ?????? WebBrowser ??? ?????; ????? ???? ????????? ?????? OLE ??????? ???? ?? ??????? ??????? ?? ??? ??????.

??? ????? ?? ?? Visual C# 2005 ? Visual C# .NET ?? ???? ?????? ????????? ActiveX ??????? ??????, ????? ??????? ???? ?????? WebBrowser ???? ?????. ???? ?????? WebBrowser (Shdocvw.dll) ?? ??? ?? Internet Explorer ?? ???? ??????? ??? ??? ??????? Internet Explorer ?????? ?????.

????? ????? Visual C# ??? ???????

?????? ????? Visual C# ???? ???? ??? ??? ??????? ???? ??????? ???????:
  1. ????? ????? ????? Windows ???? ?? Visual C# 2005 ?? ?? Visual C# .NET. ??? ????? Form1 ???? ???????.

    ?????? ?? Visual C# 2005 ??? ?? ??? ??? SHDocVw.dll ?? ??? AxSHDocVw.dll ?????? ????? ?????? ?? ???? ??????? Visual Studio:
    aximp %WINDIR%\system32\shdocvw.dll
    ?? ?? ?????? ???? ??? ????? ??? ???? (SHDocVw.dll) ? ???? ????? Windows (AxSHDocVw.dll) ????? ???? ?????? ??? Microsoft. ?????? ????? DLL ?? Visual C# 2005 ???? ??????? ???????:
    1. ?? ??????? ??????? ???? ??? ????? ????.
    2. ?? ???? ?????? ????? ??????? ???? ??? ???????.
    3. ??? ???? ?? ??? ??? AxSHDocVw.dll ???? SHDocVw.dll.
    4. ?????? ????? ??????? ?????? ???? ??????? ????? ???? ??? "?????".
  2. ?? ??????? ?????? ???? ??? ????? ???? ??????? ???? ???? ?????? ????? ???? ???????. ??? ????? ??????? ?????? COM ????? ???? ??? WebBrowser Microsoft. ???? ??? ????? ?????? ???? ?????? WebBrowser ??? ???? ??????? ????? Windows. ???? ???? ?????? WebBrowser ?? ???? Explorer ?? ???? ???????.

    ?????? ?? Visual Studio 2005 ? ?? ??? ???? ??? ?????? 2.
  3. ???????? "???? ???????" ? ?? ?????? ???? ???? WebBrowser ???? ???? OpenFileDialog ??????? CommandButton ??? Form1. ???? ??? ??? ????? ??????? ??????? AxWebBrowser1 ? OpenFileDialog1Button1 ??? ??? Form1. ?? Visual C# 2005 ? ?? ????? ??????? ??????? webBrowser1 ? openFileDialog1button1.
  4. ??? Form1 ? ???? ????? ??????? ??? Button1. ???? ??? ??? ????? ????? Button1_Click Form1.
  5. ?? ???? ????????? ???????? ?? Form1 ????? ????? ????? ??????? ??? ???????:
    using System.Reflection;
    					
  6. ????? ??? ??? ?? ??? Form1 ??? ???:
    private Object oDocument; 
  7. ?? ????? ??????? InitializeComponent ??? Form1 ?????? ???????? ???????? ??????? ??????? ??????? Form1_Load ? Form1_ClosedaxWebBrowser1_NavigateComplete2:
    this.axWebBrowser1.NavigateComplete2 += new AxSHDocVw.DWebBrowserEvents2_NavigateComplete2EventHandler(this.axWebBrowser1_NavigateComplete2);
    this.Load += new System.EventHandler(this.Form1_Load);
    this.Closed += new System.EventHandler(this.Form1_Closed);
    					
  8. ???????
    private void button1_Click(object sender, System.EventArgs e)
    {
    }
    					
    ?? ???????? ???????? ???????: button1_Click(object sender, System.EventArgs e) ????? ????
    private void button1_Click(object sender, System.EventArgs e)
    {
    
     String  strFileName;
    
     //Find the Office document.
     openFileDialog1.FileName = "";
     openFileDialog1.ShowDialog();
     strFileName = openFileDialog1.FileName;
    	        
     //If the user does not cancel, open the document.
     if(strFileName.Length != 0)
     {
      Object refmissing = System.Reflection.Missing.Value;
      oDocument = null;
      axWebBrowser1.Navigate(strFileName, ref refmissing , ref refmissing , ref refmissing , ref refmissing);
     }
    }
    
    public void Form1_Load(object sender, System.EventArgs e)
    {
     button1.Text = "Browse";
     openFileDialog1.Filter = "Office Documents(*.doc, *.xls, *.ppt)|*.doc;*.xls;*.ppt" ;
     openFileDialog1.FilterIndex = 1;
    }
    
    public void Form1_Closed(object sender, System.EventArgs e)
    {
     oDocument = null;
    }
    
    public void axWebBrowser1_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e)
    {
    
     //Note: You can use the reference to the document object to 
     //      automate the document server.
    
     Object o = e.pDisp;
       
     oDocument = o.GetType().InvokeMember("Document",BindingFlags.GetProperty,null,o,null);
    			
     Object oApplication = o.GetType().InvokeMember("Application",BindingFlags.GetProperty,null,oDocument,null);
    
     Object oName = o.GetType().InvokeMember("Name",BindingFlags.GetProperty ,null,oApplication,null);
    
     MessageBox.Show("File opened by: " + oName.ToString() ); 
    }
    					
    ?????? ??? ??? ????? ????????? ???????? ?? Visual Studio 2005. ???? ???????? Visual C# ????? ????? ??? ??????? ??? ????? ?????? ????? ????? Windows. ????? ??????? Form1. ??? ????? ??????? ???? ???? ??????? Form1.cs ? Form1.designer.cs. ????? ????????? ???????? ?? Form1.cs. ??? ????? Form1.designer.cs ??? ???? & ???? ????? Windows ????????? ???????? ???? ???? ?????? ???? ????????? ?????? ?????? ??? ?????? ????? ?????? ?? ???? ???????.

    ?????? ??? ???? ?? ????????? ??? ???? ????? Windows ?? Visual C# 2005 ?????? Microsoft ??????? ?????? ???? ??? Network (MSDN):
    http://msdn2.microsoft.com/en-us/library/ms173077.aspx
  9. ???? F5 ?????? ???????. ??? ????? ??? "???????" ? ???? ???? ?????? ??? ??? ???? ?? ????????? ?????? ??? ????? Word ?? ???? ??? Excel ?? PowerPoint ??????. ??? ?? ??? ?? ???? ??? ???. ??? ??????? ???? ???? ?????? WebBrowser ????? ???? ????? ???? ??? ???? ??????? Office.

?? ??? ???????? ??? ??????? ???? ?????? WebBrowser

??? ?????? ?? ??? ??? ??????? ???? ?????? WebBrowser:
  • ?????? ???? ?????? WebBrowser ????????? ???? ??? ??????. ??? ??????? WebBrowser1.Navigate ????? ????????? ???? ?????? ????? ?? Visual C# ??????? ??? ??????? ?? ?????? ???? ????. ??? ??? ???? ????? ??????? ??????? ????? ??? ??????? ????? NavigateComplete2 ?? ??? ?????? ????? ????? ????? ???????. ??????? ????? ??????? ???? WebBrowser ???? ?? ?????? ?? ?????? ??? ???? ??? ???? ????? Office ???? ?? ????????? ???????? ?????? ??? ?????? ??? oDocument.
  • ?? ???? ???? ?????? WebBrowser ??? ???????.
  • ?? ??????? Internet Explorer 5.0 ?????????? ??????, ??? ????? ????? ???? ???????? ????????? ???????? ???????:
     // This is a toggle option, so call it once to show the 
     // toolbars and once to hide them. This works with Internet Explorer 5
     // but often fails to work properly with earlier versions.
     
     Object refmissing = System.Reflection.Missing.Value;
     axWebBrowser1.ExecWB(SHDocVw.OLECMDID.OLECMDID_HIDETOOLBARS, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER,ref refmissing , ref refmissing);
    					
  • ???? ?????? ?? ???????? ???????? ?? ???? ???? ?? ???? ???? WebBrowser ?? ????? ? ?? ???? ?? ???? ???? ????? ?? ??? ??? ????? Office (??? ???? ??????? Word ?? ????? ??? Excel ????). ???? Microsoft ?????? ???? ???? ???? ??? ??? ????? ?? ?????? ??? ????? ???? ?? ?? ???.

    ???? ??????? ?????? ?????? ?? ????? ??????? Microsoft Office ???? ???? ?????. ??? ??? ???? ????? ???? WebBrowser ?? ??? ??????? ?? ????? ????? ?? ??????? Word ??? ??? ??? ????? ??????? ???????? ??? ???????? ??????? ?????? ????? ??? ?? ????? ??????? ???? ????? ???? ????. ?????? ????? ??? ???? ????????.
  • ???? ???? ?????? WebBrowser ???????? ?????? ?? ??? ????? ??? ??? ??? (?? ?? ??? ?????? ?????? ??????? ?? ????????? ???????? ?????? ??) ? ?????? ??? ???? ????? ????????? ???????? ????????? ???????? ???????:
       AxWebBrowser1.Navigate("about:blank");
    					

?? ??? ???????? ??? ??????? ???? ?????? WebBrowser ?? ????? Microsoft Office 2007

???? ???????? ????? 2007 Office ?? ??? ???? ??????? Office ?? ?????? ???. ???? ??? ?????? ????? ??? ???? ?????? WebBrowser. ???? ???????? ????? ????? ActiveX ???? ????? ?? ???? ?????? WebBrowser ??? ????? ????????? ??? ??????? Office 2007. ????? ?? ????????? ??? ?????? ??????? ActiveX ???? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
311765???? ???? ActiveX C++ ??????? ???????? ??????? ?? Visual Basic ?? HTML
???????? ???????? ???? ????? ???????? ?? ????????? ??????? ?? ???? ?????? WebBrowser ? ????? ????? ??????? ?????? Internet Explorer. ????? ??????? ??? ??????? ??? ????? Internet Explorer ???? ??????? 2007 Office ?? ?????? ???. ????? ?? ?????????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
927009??? ??? ???? ???? ??? ?????? ??? ????? ?????? Microsoft Office 2007 ?? Windows Internet Explorer 7
?????? ??? ??? ?????? ??????? ???????? ??????? ?????? ???? ?? ????? "????? ??????? ?? Microsoft" 927009 ???? ????????? ??? ???? ?????? WebBrowser ???? ???????? ?? ???????. ???? ????????? ??? ???? ?????? Internet Explorer. ???????? ??? ???? ?? ?? ???? ??? ??????? ?? ????????? ?????????? ?? ??????? Microsoft Office. ?????? ???? ???????? ??? ??????? ??? ??????? ?? ????? ?????.

?????

?????? ??? ???? ?? ????????? ??? ??????? ???? ?????? WebBrowser ???? ??? ????? ???????? ??????? ?????? ?? "????? ??????? ?? Microsoft:
304562?? ???? Visual Studio 2005 ? Visual Studio .NET ???? ???? ????? OLE ?????? ??????? Windows
243058????? ??????? ???? ?????? WebBrowser ??? ????? Office
162719????? ??????? ???? ?????? WebBrowser ?? Visual Basic 5.0
202476BUG: ????? ????? ????? Word ?? ???? ?????? OLE "??" WebBrowser
188271????? ????? ??????? ???? ???? "?????? ???" ?? VB
191692?? ??? ????? Shdocvw.dll ?? ???? ??????? PDW
238313?????? ??? ???? ???? ????? ?????? ?????? ?? Visual Basic
927009??? ??? ???? ???? ??? ?????? ??? ????? ?????? Microsoft Office 2007 ?? Windows Internet Explorer 7

???????

???? ???????: 304662 - ????? ??? ??????: 02/?????/1428 - ??????: 9.1
????? ???
  • Microsoft Visual C# 2005
  • Microsoft Visual C# .NET 2002 Standard Edition
  • Microsoft Office Excel 2007
  • Microsoft Office Excel 2003
  • Microsoft Excel 2002 Standard Edition
  • Microsoft Excel 2000 Standard Edition
  • Microsoft Office PowerPoint 2007
  • Microsoft Office PowerPoint 2003
  • Microsoft PowerPoint 2002 Standard Edition
  • Microsoft PowerPoint 2000 Standard Edition
  • Microsoft Office Word 2007
  • Microsoft Office Word 2003
  • Microsoft Word 2002 Standard Edition
  • Microsoft Word 2000 Standard Edition
????? ??????: 
kbmt kbactivedocs kbautomation kbhowto kbwebbrowser KB304662 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????304662

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com