⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 311765 - sample visual c++ activex control for hosting office documents in visual basic or html.htm

📁 在线编辑WORD文档
💻 HTM
📖 第 1 页 / 共 5 页
字号:
                  following: <PRE>  DsoFramer1.Open "C:\Plain.txt", , "Word.Document" 
				</PRE>If you combine this ability with a URL, you can use 
                  code that resembles the following to open the resulting HTML 
                  streamed back from an ASP file and have it display as data 
                  inside of Excel: <PRE>  DsoFramer1.Open "https://secureserver/test/mytest.asp?id=123", True, _
        "Excel.Sheet", "MyUserAccount", "MyPassword"
				</PRE>The user can then edit the results and save the file 
                  as a local file on disk, or save the file to the server as a 
                  new file in a Web folder.<BR><BR>
                  <H4>Save Documents</H4>To save a document, you can use the 
                  menu or call the <STRONG>Save</STRONG> method. The 
                  <STRONG>Save</STRONG> method acts both as a simple 
                  <STRONG>Save</STRONG> command and as a <STRONG>SaveAs</STRONG> 
                  command, depending on whether you pass a file location for the 
                  first parameter. If the current file was opened read-only and 
                  you do not specify a save location, a read-only error occurs. 
                  For more information, see the "Custom Error Messages" 
                  section.<BR><BR>You can also save to a Web folder on a remote 
                  server if that server supports either Microsoft FrontPage 
                  Server Extensions (FPSE) or the Web Distributing Authoring and 
                  Versioning (WebDAV) protocol extension for HTTP. The following 
                  code shows a new file that is saved to a remote file server: <PRE>  DsoFramer1.CreateNew "PowerPoint.Show"
  ' Let user edit the document, then save it.
  DsoFramer1.Save "http://myserver/mypresentations/test.ppt"
				</PRE>By default, if a file already exists at the given 
                  location, you receive an error message. However, by setting 
                  the <EM>OverwriteExisting</EM> parameter to True, you can 
                  explicitly tell the control to overwrite the file.<BR><BR>
                  <H4>Handle Your Own File Commands</H4>Every time a user 
                  selects an item from the <STRONG>File</STRONG> menu or an item 
                  on a toolbar that is associated with a file command, the 
                  <STRONG>OnFileCommand</STRONG> event is raised. The event 
                  allows you to override the default behavior for the control 
                  and supply your own custom actions and dialog boxes to do 
                  normal file operations.<BR><BR>You can also enable or disable 
                  items on the <STRONG>File</STRONG> menu by using the 
                  <STRONG>EnableFileCommand</STRONG> property. For example, the 
                  following code disables the <STRONG>Print</STRONG> command, 
                  and then traps print calls to prevent a user from printing: <PRE>Private Sub Form_Load()
    DsoFramer1.EnableFileCommand(dsoFilePrint) = False
End Sub

Private Sub DsoFramer1_OnFileCommand(ByVal Item As _
DSOFramer.dsoFileCommandType, Cancel As Boolean)
    If Item = dsoFilePrint Then
        MsgBox "You asked to print, but I won't allow it."
        Cancel = True
    End If
End Sub
				</PRE>
                  <H4>Show or Hide the Titlebar or Toolbars</H4>You can 
                  programmatically show or hide either the title bar or toolbars 
                  by setting these parameters to True or False. This may be 
                  useful when you try to restrict user actions or control the 
                  appearance of the document while it is embedded.<BR><BR>Note 
                  that not all toolbars may be hidden when you set 
                  <EM>Toolbars</EM> to False. The ActiveX document server must 
                  determine which tools can be switched on and off, and when 
                  this is possible. It is better to set this property before you 
                  open or create a new document so that the server is aware of 
                  your choice at the time of the initial embedding. Note that 
                  although all Office servers support switching tools on and 
                  off, some third-party servers may not.<BR><BR>
                  <H4>Custom Error Messages</H4>In addition to the standard COM 
                  error messages, the control can return one of the following 
                  custom error messages:<BR><BR><SPAN class=weboutput><FONT 
                  size=2>
                  <TABLE borderColor=#000000 cellSpacing=0 cellPadding=4 
                  width="95%" align=center borderColorLight=#ffffff border=1>
                    <TBODY>
                    <TR>
                      <TH bgColor=#c0c0c0><FONT size=2>Error Number</FONT></TH>
                      <TH bgColor=#c0c0c0><FONT 
size=2>Description</FONT></TH></TR>
                    <TR>
                      <TD><FONT size=2>0x80041102</FONT></TD>
                      <TD><FONT size=2>The ProgID is incorrect, or the 
                        associated server is not installed.</FONT></TD></TR>
                    <TR>
                      <TD><FONT size=2>0x80041103</FONT></TD>
                      <TD><FONT size=2>The associated program is not an 
                        ActiveX document server.</FONT></TD></TR>
                    <TR>
                      <TD><FONT size=2>0x80041104</FONT></TD>
                      <TD><FONT size=2>The command is not supported by the 
                        document server.</FONT></TD></TR>
                    <TR>
                      <TD><FONT size=2>0x80041105</FONT></TD>
                      <TD><FONT size=2>Unable to perform action because 
                        document was opened in read-only mode.</FONT></TD></TR>
                    <TR>
                      <TD><FONT size=2>0x80041106</FONT></TD>
                      <TD><FONT size=2>Opening/saving a document from a URL 
                        requires the Microsoft Internet Publishing Provider 
                        installed with MDAC 2.5 or Office 
                    2000/XP.</FONT></TD></TR></TBODY></TABLE></SPAN>
                  <H4>Notice of Use, Distribution, and Support</H4>Microsoft 
                  provides programming examples for illustration only, without 
                  warranty either expressed or implied, including, but not 
                  limited to, the implied warranties of merchantability and/or 
                  fitness for a particular purpose. This article assumes that 
                  you are familiar with the programming language being 
                  demonstrated and the tools used to create and debug 
                  procedures. Microsoft support professionals can help explain 
                  the functionality of a particular procedure, but they will not 
                  modify these examples to provide added functionality or 
                  construct procedures to meet your specific needs. If you have 
                  limited programming experience, you may want to contact a 
                  Microsoft Certified Partner or the Microsoft fee-based 
                  consulting line at (800) 936-5200. For more information about 
                  Microsoft Certified Partners, please visit the following 
                  Microsoft Web site: 
                  <P class=indent><A class=URLLink 
                  href="http://support.microsoft.com/default.aspx?scid=http%3a%2f%2fwww.microsoft.com%2fpartner%2freferral%2f" 
                  target=_top>http://support.microsoft.com/default.aspx?scid=http%3a%2f%2fwww.microsoft.com%2fpartner%2freferral%2f</A></P>For 
                  more information about the support options that are available 
                  and about how to contact Microsoft, visit the following 
                  Microsoft Web site: 
                  <P class=indent><A class=URLLink 
                  href="http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS" 
                  target=_top>http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS</A></P></DIV>
                  <DIV class=references>
                  <H2>REFERENCES</H2>For additional information about ActiveX 
                  document containment from Visual C++, click the article number 
                  below to view the article in the Microsoft Knowledge Base: 
                  <P class=indent><A class=KBlink 
                  href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;268470">268470</A> 
                  SAMPLE: FramerEx.exe Is an MDI ActiveX Document Container 
                  Sample Written in Visual C++ </P></DIV>
                  <DIV class=appliesto id=appliesto name="appliesto">
                  <H3>The information in this article applies to:</H3>
                  <UL>
                    <LI>Microsoft Office XP Developer
                    <LI>Microsoft Office 2000 Developer
                    <LI>Microsoft Visual C++, 32-bit Professional Edition 
                    6.0</LI></UL></DIV>
                  <TABLE class=docinfo cellSpacing=1 cellPadding=3 
                    align=center><TBODY>
                    <TR>
                      <TD class=label vAlign=top noWrap align=right 
                        width="5%">Last Reviewed:</TD>
                      <TD class=data vAlign=top align=left>6/18/2004 (4.1) 
                    </TD></TR>
                    <TR class=composite>
                      <TD class=label vAlign=top noWrap align=right 
                        width="5%">Keywords:</TD>
                      <TD class=data vAlign=top align=left>kbdownload kbfile 
                        kbinfo kbSample KB311765</TD></TR></TBODY></TABLE><BR>
                  <DIV class=disclaimer></DIV><!-- - - - - - - - - - - - PAGE TEXT ENDS ABOVE HERE - - - - - - - - - - - --></FONT></FONT></FONT></TD></TR>
              <TR>
                <TD 
            align=middle><!--GETHELP_HORI--></TD></TR></TBODY></TABLE></DIV></DIV></DIV></XMLREADER></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<DIV class=tpl_footer id=BottomPanel name="BottomPanel">
<TABLE class=tpl_footer_row1>
  <TBODY>
  <TR>
    <TD class=fbtn_cell>&nbsp;<A 
      href="http://support.microsoft.com/default.aspx?scid=fh;ZH-CN;GSSHELP" 
      target=_top>帮助</A>&nbsp;</TD></TR></TBODY></TABLE><BR>
<DIV class=tpl_footer_row2><A class=ftr_copyright_text 
href="http://support.microsoft.com/default.aspx?scid=http%3a%2f%2fwww.microsoft.com%2fchina%2fmisc%2fcpyright.htm" 
target=http://support.microsoft.com/default.aspx?scid=http%3a%2f%2fwww.microsoft.com%2fchina%2fmisc%2fcpyright.htm>© 
2004 Microsoft Corporation 版权所有.保留所有权利</A>&nbsp;&nbsp;<A 
class=ftr_copyright_text 
href="http://support.microsoft.com/default.aspx?scid=http%3a%2f%2fwww.microsoft.com%2finfo%2fcn%2fprivacy.htm" 
target=http://support.microsoft.com/default.aspx?scid=http%3a%2f%2fwww.microsoft.com%2finfo%2fcn%2fprivacy.htm>隐私声明</A>&nbsp;&nbsp;<A 
class=ftr_copyright_text 
href="http://support.microsoft.com/default.aspx?scid=http%3a%2f%2fwww.microsoft.com%2fchina%2fenable%2fdefault.htm" 
target=http://support.microsoft.com/default.aspx?scid=http%3a%2f%2fwww.microsoft.com%2fchina%2fenable%2fdefault.htm>Microsoft 
辅助功能</A>&nbsp;&nbsp;</DIV></DIV><IMG style="DISPLAY: none" 
src="311765 - SAMPLE Visual C++ ActiveX Control for Hosting Office Documents in Visual Basic or HTML.files/1ptrans.gif" 
name=metrixgif>
<SCRIPT language=JavaScript>   function thisLoad(){setcookieval("SITE","GN");gsfxUpLevel();   g_reSupportedHostnames = new RegExp(".msn.com$|.passport.com$|.xbox.com$|.microsoft.com$|.microsoft.cz$|.msbpn.com$|.microsoft.co.*", "i");  ForeignLink_Hookup(true);LogHit('http://c.microsoft.com/trans_pixel.asp?TYPE=SSPV&SOURCE=SUPPORT&URI=/GN/ZH-CN/kb_en-us_311765&GUID=1F4FC18C-F71E-47fb-8FC9-612F8EE59C61&R=');   }function thisUnload(){fireTrigger('/common/survey.aspx?scid=sw;zh-sim;1035&XSL=','GN','ZH-CN','%252fdefault.aspx%253fscid%253dhttp%253a%252f%252fsupport.microsoft.com%253a80%252fsupport%252fkb%252farticles%252fq311%252f7%252f65.asp','kb','EN-US','311765','','','','','','','');;   }</SCRIPT>
 </BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -