• <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.¢% 閱讀(803) 評論(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. 99精品久久精品一区二区| 国产成人精品久久二区二区| 亚洲精品高清久久| 久久综合给合久久狠狠狠97色| 99国产欧美精品久久久蜜芽 | 99久久精品免费看国产一区二区三区 | 国产亚洲综合久久系列| 久久国产免费观看精品| 色综合久久综合中文综合网| 久久午夜福利无码1000合集| 久久久SS麻豆欧美国产日韩| 久久精品国产亚洲AV高清热 | 久久国产三级无码一区二区| 久久久久久久久久久| 婷婷久久五月天| 精品久久久久中文字幕日本| 国产精品成人99久久久久 | 91精品国产91久久久久福利| 久久久久久久尹人综合网亚洲| 亚洲国产精品综合久久网络| 一本色道久久综合狠狠躁篇| 国产精品9999久久久久| 韩国三级大全久久网站| 久久亚洲国产中v天仙www| 狠狠色婷婷久久一区二区三区| 国产精品美女久久久| 热久久这里只有精品| 久久这里只有精品久久| 日本精品久久久久中文字幕8| 国产aⅴ激情无码久久| 无码人妻久久一区二区三区免费丨 | 久久www免费人成精品香蕉| 久久不见久久见免费影院www日本| 国产精品久久久久久久人人看| 久久这里都是精品| 97久久国产综合精品女不卡 | 久久一日本道色综合久久| 午夜精品久久久久久| 国产精品久久久香蕉| 久久久久久久99精品免费观看| 久久精品国产久精国产果冻传媒 |