• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            S.l.e!ep.¢%

            像打了激速一樣,以四倍的速度運轉,開心的工作
            簡單、開放、平等的公司文化;尊重個性、自由與個人價值;
            posts - 1098, comments - 335, trackbacks - 0, articles - 1
              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

            MFC 調用Automation(一)

            Posted on 2009-10-03 23:55 S.l.e!ep.¢% 閱讀(800) 評論(0)  編輯 收藏 引用 所屬分類: Office Automation
            看到的是這篇文章
            http://www.vckbase.com/document/viewdoc/?id=1186
            ? 調用word
            http://www.vckbase.com/document/viewdoc/?id=648??? office 插件開發
            http://tech.163.com/05/0201/10/1BGGKDV90009159Q.html?ATL開發 office插件

            Create an automation project

            1. With Microsoft Developer Studio, start a new "MFC AppWizard (exe)" project named "AutoProject."
            2. In step 1 of the MFC AppWizard, choose "Dialog Based" for the application type and then click Finish.
            3. Click ClassWizard on the View menu (or press CTRL+W).
            4. Select the Automation tab. Click Add Class and choose "From a type library." Navigate to select the object library for the application you wish to automate (for this example, if you are automating Excel 97, choose the Microsoft Excel 8.0 Object Library; the default location is C:\Program Files\Microsoft Office\Office\Excel8.olb).
              Excel 2003. XL5EN32.OLB
            5. NOTE: The list box in the Confirm Classes dialog box contains all of the IDispatch interfaces (which are virtually identical to classes) in the Microsoft Excel type library. In the lower half of the dialog box you will see that an Implementation file named Excel8.cpp contains generated class wrappers derived from ColeDispatchDriver(), and the appropriate declaration header file is named Excel8.h. (For Excel 2002 and Excel 2003, the files are named Excel.cpp and Excel.h.)
            6. Click OK to close the MFC ClassWizard dialog box.
          1. Add the following code to the CAutoProjectApp::InitInstance() function, which loads and enables the COM services library:
                  BOOL CAutoProjectApp::InitInstance()
                  {
                     if(!AfxOleInit())  // Your addition starts here
                     {
                        AfxMessageBox("Could not initialize COM dll");
                        return FALSE;
                     }                 // End of your addition
            
                     AfxEnableControlContainer();
                  .
                  .
                  .
            
                  }
            					
          2. Add the following line to the #include statements at the top of the AutoProject.cpp program file:
                  #include <afxdisp.h>
            					
          3. Add the include statement for excel8.h after the include statement for stdafx.h at the top of the AutoProjectDlg.cpp program file:
                  #include "stdafx.h"
                  #include "excel8.h" // excel.h in the case of Excel 2002 and Excel 2003.
            					
          4. Add automation code to the CAutoProjectDlg::OnRun() so that it appears as shown below:
                  void CAutoProjectDlg::OnRun()
                  {
                      _Application app;  // app is the Excel _Application object
            
                      // Start Excel and get Application object...
                     if(!app.CreateDispatch("Excel.Application"))
                     {
                        AfxMessageBox("Couldn't start Excel.");
                     }
                     else
                     {
                        //Make Excel Visible and display a message
                      app.SetVisible(TRUE);
                      AfxMessageBox ("Excel is Running!");
                     }
                  }
            					

            ?????????

          5. www.久久热.com| 热久久这里只有精品| 开心久久婷婷综合中文字幕| 久久久久亚洲AV成人网人人网站| 欧洲性大片xxxxx久久久| 亚洲人成精品久久久久| 久久久久国产一级毛片高清版| 久久人人爽人爽人人爽av| 欧美噜噜久久久XXX| 国产精品gz久久久| 亚洲伊人久久精品影院| 久久综合狠狠综合久久激情 | 久久久久一本毛久久久| 九九99精品久久久久久| 久久这里只精品99re66| 日本三级久久网| 人妻少妇久久中文字幕| 欧美一级久久久久久久大| 久久久综合九色合综国产| 无码国内精品久久人妻蜜桃| 久久99精品国产麻豆婷婷| 精品国产一区二区三区久久久狼| 无码精品久久一区二区三区| 久久精品成人| 99久久99久久精品国产片| 久久99国产综合精品女同| 国产欧美久久久精品影院| 久久亚洲国产欧洲精品一| 国内精品久久久久影院免费| 欧洲精品久久久av无码电影 | 中文精品久久久久人妻| 国产V亚洲V天堂无码久久久| 亚洲中文字幕久久精品无码APP| 一本大道久久东京热无码AV| 国产高清国内精品福利99久久| AV狠狠色丁香婷婷综合久久| 麻豆亚洲AV永久无码精品久久| 亚洲精品无码久久久久去q| 2021国产精品久久精品| 久久精品一本到99热免费| 一日本道伊人久久综合影|