• <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. 日韩精品国产自在久久现线拍| 久久精品国产亚洲av瑜伽| 亚洲v国产v天堂a无码久久| 思思久久好好热精品国产| 精品国产乱码久久久久软件 | 国产精品嫩草影院久久| 色婷婷久久久SWAG精品| 国产产无码乱码精品久久鸭| 久久久久久久国产免费看| 亚洲va久久久噜噜噜久久| 国产一区二区精品久久凹凸| 久久综合久久综合亚洲| 国产精品9999久久久久| 久久久久99这里有精品10| 国产精品99久久久久久www| 热re99久久精品国99热| 久久精品国产72国产精福利| 国产精品一久久香蕉国产线看观看 | 国内精品伊人久久久影院| 国产午夜久久影院| 亚洲午夜久久久久久久久电影网| 国产精品99久久久久久董美香| 久久精品国产精品亚洲毛片| 久久久午夜精品福利内容| 久久99国产精品成人欧美| 精品免费tv久久久久久久| 精品免费久久久久久久| 色综合久久久久无码专区 | 久久se精品一区精品二区国产| 国产亚洲精品自在久久| 无码精品久久久久久人妻中字| 久久婷婷是五月综合色狠狠| 三级片免费观看久久| 久久精品国产亚洲Aⅴ香蕉| 国内精品久久久久久久久 | 色欲久久久天天天综合网精品| 久久SE精品一区二区| 婷婷久久香蕉五月综合加勒比| 久久久无码人妻精品无码| 久久国产精品一国产精品金尊| 久久久久久无码Av成人影院|