Microsoft ????????? ???? ?? ??? ????? C++ 5.0 ?? ????? C++ 6.0 ?? ????? ?? PowerPoint ?? ???????? ???? ?? ??? ???? ????

???? ?????? ???? ??????
???? ID: 222960 - ?? ???????? ?? ?????? ??? ?? ?? ???? ???? ???? ??.
??? ?? ??????? ???? | ??? ?? ??????? ????

??????

?? ???? ????? ???? ?? ?? Microsoft PowerPoint ?? ????? ?? Visual C++ 5.0 ?? ????? C++ 6.0 ?? ??? Microsoft ????????? ???? (MFC) ?? ???????? ???? ?????

???? ???????

PowerPoint ??? ??????? ?? ????? ???? ???, ?????? ?? ?? ???? ??? ????????? ?????? ??????, ???????? ?? ????????? ?? ??????? ????? ?? ?????? ???? ?? ???? ????? ????? ?? ??????? ?????? ????? ?? ??? ????? ????? ?? ???? ????:
  1. ??? ??? ?????-?????? MFC EXE ????????? ??????
  2. ?? ??? ?? ????? ????? ??? ???? ?? ?? BN_CLICKED-?????? ?? ??? ?? ??? ???????
  3. ?????ClassWizard(Ctrl + W), ????? ?????????????? ??,????? ??????, ?? ?? ??? ???????? ?????? ????????? ??.
  4. ???? ?????????? ?? ??? ???? ?? Office (?????? ?? ???, C:\Program Files\Microsoft Office\Office) ??????? ?? ?? ?????Msppt8.olb. PowerPoint 2000 ?? ??? PowerPoint ???????? ????????? Msppt9.olb ?? ??? ??? PowerPoint 2002 ?? ??? PowerPoint ???????? ????????? ?? Msppt.olb ??, ?? ?? ???? ??, ???????? ??? ??, c:\Program Files\Microsoft Office\Office10 ??????? ??? ??? Microsoft Office PowerPoint 2003 ?? ??? PowerPoint ???????? ????????? ?? Msppt.olb ??, ?? ?? ???? ??, ??? ???????? ??? ??, c:\Program Files\Microsoft Office\Office11 ???????
  5. ??? ???? ??? ????? ??, ?? ????? ???? ?? ??? ????OK???? ????????? ??? ???? ???? ?? ???? ClassWizard PowerPoint ?????? ????????? ?? ??? ??????? "???? ????" ?? ????? ???? ??? ?? ?? Msppt8.h ?? Msppt8.cpp ?????? ???? ?? ???
  6. ???? ??? ?????? ??? ????? ??? ??????:
    // Start PowerPoint.
    _Application app;
    COleException e;
    if(!app.CreateDispatch("Powerpoint.Application", &e)) {
       CString str;
       str.Format("CreateDispatch() failed w/err 0x%08lx", e.m_sc),
       AfxMessageBox(str, MB_SETFOREGROUND);
       return;
    }
    
    // Make it visible.
    app.SetVisible(TRUE);
    
    // Get Presentations collection and add a new presentation.
    Presentations presSet(app.GetPresentations());
    _Presentation pres(presSet.Add(TRUE));
    
    // Get Slides collection and add a new slide.
    Slides slideSet(pres.GetSlides());
    _Slide slide1(slideSet.Add(1, 2));
    
    // Add text to slide, by navigating the slide as follows:
    // slide1.shapes(#).TextFrame.TextRange.Text
    {
       Shapes shapes(slide1.GetShapes());
       Shape shape(shapes.Item(COleVariant((long)1)));
       TextFrame textFrame(shape.GetTextFrame());
       TextRange textRange(textFrame.GetTextRange());
       textRange.SetText("My first slide");
    }
    {
       Shapes shapes(slide1.GetShapes());
       Shape shape(shapes.Item(COleVariant((long)2)));
       TextFrame textFrame(shape.GetTextFrame());
       TextRange textRange(textFrame.GetTextRange());
       textRange.SetText("Automating PowerPoint is easy\r\n"
          "Using Visual C++ is powerful!");
    }
    
    // Add another slide with a chart.
    _Slide slide2(slideSet.Add(2, 5));
    
    // Add text to slide as before.
    {
       Shapes shapes(slide2.GetShapes());
       Shape shape(shapes.Item(COleVariant((long)1)));
       TextFrame textFrame(shape.GetTextFrame());
       TextRange textRange(textFrame.GetTextRange());
       textRange.SetText("Slide 2's topic");
    }
    {
       Shapes shapes(slide2.GetShapes());
       Shape shape(shapes.Item(COleVariant((long)2)));
       TextFrame textFrame(shape.GetTextFrame());
       TextRange textRange(textFrame.GetTextRange());
       textRange.SetText("You can create and use charts "
          "in your PowerPoint slides!");
    }
    
    // Add a chart where the default one was created.
    {
       // First get coordinates of old chart.
       float cTop, cWidth, cHeight, cLeft;
       Shapes shapes(slide2.GetShapes());
       Shape shape(shapes.Item(COleVariant((long)3)));
       cTop = shape.GetTop();
       cWidth = shape.GetWidth();
       cHeight = shape.GetHeight();
       cLeft = shape.GetLeft();
    
       // Delete original chart.
       shape.Delete();
    
       // Now add your own back where old one was.
       Shape tmpShape(shapes.AddOLEObject(cLeft, cTop, cWidth, cHeight,
          "MSGraph.Chart", "", 0, "", 0, "", 0));
    }
    
    // Add another slide, with an Organization chart.
    _Slide slide3(slideSet.Add(3, 7));
    
    // Add text to slide as before.
    {
    
       Shapes shapes(slide3.GetShapes());
       Shape shape(shapes.Item(COleVariant((long)1)));
       TextFrame textFrame(shape.GetTextFrame());
       TextRange textRange(textFrame.GetTextRange());
       textRange.SetText("The rest is only limited by your Imagination");
    }
    // Add a chart where the default one was created.
    {
       // First get coordinates of old chart.
       float cTop, cWidth, cHeight, cLeft;
       Shapes shapes(slide3.GetShapes());
       Shape shape(shapes.Item(COleVariant((long)2)));
       cTop = shape.GetTop();
       cWidth = shape.GetWidth();
       cHeight = shape.GetHeight();
       cLeft = shape.GetLeft();
    
       // Delete original chart.
       shape.Delete();
    
       // Now add your own back where old one was.
       // The next line assumes you have the Microsoft OrgChart application
       // installed and registered on your computer.
       Shape tmpShape(shapes.AddOLEObject(cLeft, cTop, cWidth, cHeight,
          "OrgPlusWOPX.4", "", 0, "", 0, "", 0));
    }
    
    // Setup slide show properties.
    for(int i=1; i<=3; i++) {
       _Slide slide(slideSet.Item(COleVariant((long)i)));
       SlideShowTransition sst(slide.GetSlideShowTransition());
       sst.SetEntryEffect(513); // Random.
       sst.SetAdvanceOnTime(TRUE);
       sst.SetAdvanceTime(5.0); // 5-seconds per slide.
    }
    // Prepare and run a slide show.
    {
       SlideShowSettings sss(pres.GetSlideShowSettings());
       sss.SetShowType(3); // Kiosk.
       sss.SetLoopUntilStopped(TRUE);
       sss.SetRangeType(1); // Show all.
       sss.SetAdvanceMode(2); // Use slide timings.
       SlideShowWindow ssw(sss.Run()); // Run show.
    }
    
    // Sleep so user can watch slide show.
    ::Sleep(15000);
    
    // Tell PowerPoint to quit.
    app.Quit();
    					
  7. ????? ????????? ??????????? ???? ??? ?????? ???? ?? ???? ???? ??? ??????:
    #include "msppt8.h" //msppt9.h for PowerPoint 2000, msppt.h for PowerPoint 2002 and PowerPoint 2003
    
    // Ole initialization class.
    class OleInitClass {
    public:
       OleInitClass() {
          OleInitialize(NULL);
       }
       ~OleInitClass() {
          OleUninitialize();
       }
    };
    // This global class calls OleInitialize() at
    // application startup, and calls OleUninitialize()
    // at application exit.
    OleInitClass g_OleInitClass;
    					
  8. ?????? ???? ?? ??????

??????

Microsoft Office ??????????? ?? ????? C++ ??????? ?? ???? ??? ???????? ??????? ?? ??? Microsoft ???????? ??? ???? ????? ?? ??? ????? ???? ?????? ?? ????? ????:
196776Office ????? C++ ????? ??? ???????

???

???? ID: 222960 - ????? ???????: 06 ??????? 2011 - ??????: 3.0
???? ???? ???? ??:
  • Microsoft Foundation Class Library 4.2
  • Microsoft Office PowerPoint 2003
  • Microsoft PowerPoint 2002 Standard Edition
  • Microsoft PowerPoint 2000 Standard Edition
  • Microsoft PowerPoint 97 Standard Edition
??????: 
kbautomation kbhowto kbmt KB222960 KbMthi
???? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:222960

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

 

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