????? ????? ????? ??????? ???????? ???????? MFC "?" ????? ???

?????? ????????? ?????? ?????????
???? ???????: 178749 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

????? ??? ??????? ???? ? ? ???????? ????? ????? ???? ??????? ?? ??????? COM ?????? ?? ??? ??????? Microsoft Office.

??????? ????

???? ?????? ?????? ??? ????? ????? MFC ???????. ????? ?????? Microsoft Excel. ???? ??????? ??????? ???????? ?????? ??????? ?? ?? ????? ??????? ?? 9 ??? 15 ??? ????? ?? ????? ???.

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

  1. ???????? Microsoft ?????? Studio ????? ???? "AppWizard MFC (???)" ??????? ???? "AutoProject."
  2. ?? ?????? 1 ?? AppWizard MFC ???? "??? ???? ??????" ??? ??????? ?? ???? ??? ?????.

    ???? ???? ?????? "??????? ??????? ????" ????? ????? ???? ?????? ??????:
          Application: CAutoProjectApp in AutoProject.h and AutoProject.cpp
          Dialog: CAutoProjectDlg in AutoProject.h and AutoProjectDlg.cpp
    						
    "???? ??? ?????" ?????? ???????.
  3. ??? ??? ???? ?????? "IDD_AUTOPROJECT_DIALOG" ?? ????? ???????/????? Visual Studio. ????? ???????? ??? ????????? ?? ???????? ?????????.
  4. ????? ???? ???? ??????? (IDC_STATIC) ? ?? "????? ?????" (IDCANCEL).
  5. ????? ??? ???? "?????" ??? "IDRUN" ???????? ????????? ??? "?????". ?? ?????? ??????? ??????? AutoProject.rc ???? ??????.
  6. ???? ??? ClassWizard ?? ??????? ??? (?? ???? CTRL + W).
  7. ??? "??????? ???????" ??????? ????? IDRUN ?? "?????? ????" ???? ??????? ?????? "BN_CLICKED" ?? ???? ????? ???????. ???? ??? "????? ????" ??? ?????? "OnRun" ???????. ???? ??? "?????" ?????? ?? ClassWizard.

    ??????: ??? ?????? ???? ????? ?????? ????? "OnRun();" ??? ????? ????? ??? AutoProjectDLG.h. ???? ??? ?????? skeleton ????? ??????? ???? ????? ?????? CAutoProjectDlg::OnRun() ??? ????? ?????? AutoProjectDLG.cpp.
  8. ???? ??? ClassWizard ?? ??????? ??? (?? ???? CTRL + W).
  9. ??? ????? ??????? "???????" ???? ??? ??? ????? ?? ???? "?? ????? ???." ????? ??? ??? ????? ???? ??????? ???? ???? ?? ????? (?????? ??? ??? ??????, ??? ??? ??? ????? Excel 97 ???? ????? ?????? Microsoft 8.0 Excel; ?????? ????????? ?? Office\Office\Excel8.olb Files\Microsoft C:\Program).

    ??? ?? ????? Microsoft Excel 2000 ????????? ?????? Excel ????? ?????? Microsoft 9.0 ???? ???? ?????? ????????? Office\Office\Excel9.olb Files\Microsoft C:\Program.

    ??? ?? ????? Microsoft Excel 2002 ? Microsoft Office Excel 2003 ????????? ????? ???? ???? ?? ??? Excel.exe. ?? ?????? ????????? Excel.exe ?? ?????? Office 2002 Office\Office10\Excel.exe Files\Microsoft C:\program. ?? ?????? ????????? Excel.exe ?? Office 2003 Office\Office11\Excel.exe Files\Microsoft C:\program. ????? ????? ????? ?????? ???????? ???? ??? ???. ??? ???? ???? ?? ??????? ???? ?????? ?? ???? ??? ?????.

    ??????: ???? ??????? ?? ???? ?????? "????? ????" ????? ???? ???????? IDispatch (???? ???? ?????? ?????? ??? ?????? ????????) ?? ????? ????? Microsoft Excel. ?? ????? ?????? ?? ???? ?????? ????? ???? ???? ????? ??? ??? ????? ?????? Excel8.cpp wrappers ??? ????? ?? ColeDispatchDriver() ?? ?? ????? ????? ??? ????? ???????? Excel8.h. (?? Excel 2002 ? Excel 2003 ??? ????? ??????? Excel.cpp ? Excel.h.)
  10. ???? ??? ????? ?????? ???? ?????? ClassWizard MFC.
  11. ????? ????? ????????? ???????? ??????? ??? ?????? CAutoProjectApp::InitInstance() ???? ????? ?????? COM ?? ???????:
          BOOL CAutoProjectApp::InitInstance()
          {
             if(!AfxOleInit())  // Your addition starts here
             {
                AfxMessageBox("Could not initialize COM dll");
                return FALSE;
             }                 // End of your addition
    
             AfxEnableControlContainer();
          .
          .
          .
    
          }
    					
  12. ??? ?????? ????? ???? ??? # ?????? ?? ????? ?????? ?? ??? ???????? AutoProject.cpp:
          #include <afxdisp.h>
    					
  13. ????? ???? ??????? excel8.h ??? ????? ??????? stdafx.h ?? ????? ?????? ?? ??? ???????? AutoProjectDlg.cpp:
          #include "stdafx.h"
          #include "excel8.h" // excel.h in the case of Excel 2002 and Excel 2003.
    					
  14. ????? ????????? ???????? "??????? ???????? ??? CAutoProjectDlg::OnRun() ???? ???? ??? ?? ???? ?????:
          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!");
             }
          }
    					
  15. ?????? ??????? ???????. ???????: ??? ????? ??? ??????? ???? ????? ???? ?? ???? ?????? Microsoft Excel. ????? ???? ?????? Auto_Excel ?? ??????? ???? ???????. ???? ????? Microsoft Excel ??? ?????? ?????? CAutoProjectDlg::OnRun() ??? ??? ???? ???? ????? ??????? ???? ??????.

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

??? ????? ????? ?????? ?? ????? ??? ??? ??????? ????? ?? (??? ??? ?? ?????? ????? 9) ? ?????? ?? ?????? ?? ???? ??? ??????? ??? ???????. ?? ClassView ? ????? ????? ????? ??????? ??? ??? ??????? ??????? ??? ?? ??? ????? ?? ???? ????? ??????? ??? ?????? ????? ???? ????? ?????? ?? ??? ????? Excel8.cpp.

????? ??? ???????? ??? ????? ?????? ????? ??? ??? ???? ?? ?????? ?? ??? ????? ?? ??? ??? ????? ??? ????? ????? ???? ???????. ???? ?? ??? ???? ??? ?????? ????? ???? ?????? ??????? ?? ????? Excel8.h. ??? ?????? ????? ??? ?????? ?? ?? ????? ????? ?????? ??????; ?? ??? ???????? ??? ????? ??? ????? ??? ????? ??? classes--GetApplication() ?????? ?? ???? ??????.

??? ????? ?? ?? ????? ??????? ???????? ????? ????? ????? Microsoft Excel ? ????? ????? ??? ??????? ????? ????????? ??????. ????? ??????? ????? ??? ????? ??????? ?????? ??????? ?? ??????? Microsoft Office:
   Application                           Type Library
   --------------------------------------------------

   Microsoft Access 97                   Msacc8.olb
   Microsoft Jet Database 3.5            DAO350.dll
   Microsoft Binder 97                   Msbdr8.olb
   Microsoft Excel 97                    Excel8.olb
   Microsoft Graph 97                    Graph8.olb
   Microsoft Office 97                   Mso97.dll
   Microsoft Outlook 97                  Msoutl97.olb
   Microsoft PowerPoint 97               Msppt8.olb

   Microsoft Word 97                     Msword8.olb
   Microsoft Access 2000                 Msacc9.olb
   Microsoft Jet Database 3.51           DAO360.dll
   Microsoft Binder 2000                 Msbdr9.olb
   Microsoft Excel 2000                  Excel9.olb
   Microsoft Graph 2000                  Graph9.olb
   Microsoft Office 2000                 Mso9.dll
   Microsoft Outlook 2000                Msoutl9.olb
   Microsoft PowerPoint 2000             Msppt9.olb
   Microsoft Word 2000                   Msword9.olb 

   Microsoft Access 2002                 Msacc.olb
   Microsoft Excel 2002                  Excel.exe
   Microsoft Graph 2002                  Graph.exe 
   Microsoft Office 2002                 MSO.dll
   Microsoft Outlook 2002                MSOutl.olb
   Microsoft PowerPoint 2002             MSPpt.olb
   Microsoft Word 2002                   MSWord.olb

   Microsoft Office Access 2003          Msacc.olb
   Microsoft Office Excel 2003           Excel.exe
   Microsoft Graph 2003                  Graph.exe 
   Microsoft Office 2003                 MSO.dll
   Microsoft Office Outlook 2003         MSOutl.olb
   Microsoft Office PowerPoint 2003      MSPpt.olb
   Microsoft Office Word 2003            MSWord.olb
				
??????: ?? ???? ??????? ??????? ??? ??? Office\Office Files\Microsoft C:\Program (??? ???? Office 2002 ?????? C:\...\Office10 ??? ?? Office 2003 ?????? C:\...\Office11) ? ???????? Dao350.dll ?? Dao360.dll ? ? 10(MSO.dll) Microsoft Office. ?? ?????? ????????? Dao350.dll/Dao360.dll Shared\Dao Files\Microsoft Files\Common C:\Program. ?? ?????? ????????? MSO.dll Shared\Office10 Files\Microsoft Files\Common C:\Program ?? Office 2002 Shared\Office11 Files\Microsoft Files\Common C:\Program ?? Office 2003.

?????

???? ??? ??????? ????? ????? ????? ????? ???? ????. ??? ??? ???? ???? ????? ???? ???? ??? ??????? ????? ????? VC ++ ?? Studio ?????? Microsoft ???? ???? ???????? ?????? ?????? ???? ???????? InfoView Visual Studio. ???????? ???????? ??????? ???? ??? "?????" ?? ??????? "???????". ???? ??? ????? ??????? ???? ?? ???? ?? ???:
????? ?? ????????
???? ??? ??? ?????? ?????????. ??? ??????? "?????? ????????: ????? ?? ????????" ?? ???? ??? ???. ????? ?? ????????? ??? ????? ??????? Office? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
222101????? ?????? ??? ????? ???? ???? Office

???????

???? ???????: 178749 - ????? ??? ??????: 16/????? ??????/1426 - ??????: 4.3
????? ???
  • Microsoft Foundation Class Library 4.2, ????? ?????? ??:
    • Microsoft Visual C++ 5.0 Standard Edition
    • Microsoft Visual C++ 6.0 Service Pack 5
  • Microsoft Office XP Developer Edition
  • Microsoft Office 2000 Developer Edition
????? ??????: 
kbmt kbautomation kbhowto kbinterop KB178749 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????178749

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

 

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