Makale numarası: 308336 - Son Gözden Geçirme: 29 Haziran 2007 Cuma - Gözden geçirme: 5.3
Otomasyon oluşturmak ve PowerPoint 2000 sunusunu veya sunuyu PowerPoint 2002, Visual C++ .NET 2002 veya Visual C++ .NET 2003 ve Microsoft Foundation Classes kullanarak göstermek için nasıl kullanılır
Not Microsoft Visual C++ .NET 2002 ve Visual C++ .NET 2003, Microsoft .NET Framework tarafından sağlanan bir yönetilen kod model hem de yerel Microsoft Windows kod modeli yönetilmeyen destekler. Bu makaledeki bilgiler yalnızca yönetilmeyen Visual C++ kod uygulanır.
Bu makalede, otomasyon oluşturmak ve Microsoft PowerPoint 2000 sunusunu veya sunuyu PowerPoint 2002, Visual C++ .NET 2002 veya Visual C++ .NET 2003 ve Microsoft Foundation Classes (ingilizce)'nı kullanarak göstermek için nasıl kullanılacağı açıklanır.
Temel bir otomasyon istemci oluşturmak için aşağıdaki Microsoft Bilgi Bankası makalesinde "Bir otomasyon istemci oluşturma" bölümündeki adımları izleyin:
307473
(http://support.microsoft.com/kb/307473/
)
Visual C++ .NET'den Office Otomasyonu için bir tür kitaplığı nasıl kullanılır
Makalenin 4. adımda, tür kitaplığı Microsoft PowerPoint ve Microsoft Graph tür kitaplığını seçin. PowerPoint 2000 için varsayılan konum C:\Program Files\Microsoft Office\Office\Msppt9.olb olduğundan, PowerPoint 2002 için varsayılan konum C:\Program Files\Microsoft Office\Office10\Msppt.olb olduğu ve Microsoft Office PowerPoint 2003 için varsayılan konum C:\Program Files\Microsoft Office\Office11\Msppt.olb olduğu. Graph 2000 için varsayılan konum C:\Program Files\Microsoft Office\Office\graph9.olb olan, grafik 2002 için varsayılan konum C:\Program Files\Microsoft Office\Office10\Graph.exe olduğu ve Graph 2003 için varsayılan konum C:\Program Files\Microsoft Office\Office11\Graph.exe olduğu. Sonra aşağıdaki PowerPoint seçme arabirimi:
_Application
_Presentation
_Slide
Yazı tipi
OleFormat
Sunular
ShadowFormat
Şekli
Şekiller
SlideRange
Slayt
SlideShowSettings
SlideShowTransition
SlideShowWindows
MetinÇerçevesi
TextRange
Aşağıdaki grafik arabirimi seçin:
Grafik
Adım 6'da, aşağıdaki # include için Autoprojectdlg.cpp ekleyin:
IDD_AUTOPROJECT_DIALOG iletişim kutusunda, Çalıştır ' ı sağ tıklatın ve olay işleyicisi Ekle'ı seçin. Olay işleyicisi Sihirbazı'nı tıklatın, BN_CLICKED ileti türünü seçin ve Ekle ve Düzenle'yi tıklatın.
Aşağıdaki kod
void CAutoProjectDlg::OnBnClickedRun()
{
// TODO: Add your control notification handler code here
}
ile:
void CAutoProjectDlg::OnBnClickedRun()
{
CApplication pptApp;
CPresentations pptPresentations;
CPresentation pptPresentation;
CSlides pptSlides;
LPDISPATCH pdisptemp = NULL;
//Template for the PowerPoint presentation.
const CString strPresentationTemplate("C:\\Program Files\\Microsoft "\
"Office\\Templates\\Presentation Designs\\Blends.pot");
//Bmp to put on slide.
const CString strPicture("C:\\WINNT\\Soap Bubbles.bmp");
//Automate PowerPoint and get a reference to the
//PowerPoint.Application object.
if(!pptApp.CreateDispatch("PowerPoint.Application"))
{
AfxMessageBox("Couldn't start PowerPoint and get Application object.");
return;
}
else
{
//Make the application visible.
pptApp.put_Visible(TRUE);
//Get the Presentations collection.
pptPresentations = pptApp.get_Presentations();
//Open a presentation based on the template.
pptPresentation = pptPresentations.Open(strPresentationTemplate, FALSE,
TRUE ,TRUE);
//Get the slides.
pptSlides = pptPresentation.get_Slides();
//Build Slide #1:
{
//PowerPoint.PpSlideLayout.ppLayoutTitleOnly = 11
CSlide pptSlide(pptSlides.Add(1,11));
CShapes slideshapes(pptSlide.get_Shapes());
COleVariant varindex(1L);
CShape slideshape(slideshapes.Item(varindex));
CTextFrame txtFrame(slideshape.get_TextFrame());
CTextRange txtrange(txtFrame.get_TextRange());
//Add text to the slide and format the text.
txtrange.put_Text("My Sample Presentation");
CFont0 objFont(txtrange.get_Font());
objFont.put_Name("Comic Sans MS");
objFont.put_Size(48);
//Add the picture to the slide.
pdisptemp = slideshapes.AddPicture(strPicture,FALSE, TRUE, 150,
150, 500, 350);
pdisptemp->Release();
}
//Build Slide #2:
{
//PowerPoint.PpSlideLayout.ppLayoutTitleOnly = 11
CSlide pptSlide(pptSlides.Add(2,11));
CShapes slideshapes(pptSlide.get_Shapes());
COleVariant varindex(1L);
CShape slideshape(slideshapes.Item(varindex));
CTextFrame txtFrame(slideshape.get_TextFrame());
CTextRange txtrange(txtFrame.get_TextRange());
//Add and format text.
txtrange.put_Text("My Chart");
CFont0 objFont(txtrange.get_Font());
objFont.put_Name("Comic Sans MS");
objFont.put_Size(48);
//Add a third pie chart.
CShape slideshape1(slideshapes.AddOLEObject(150,150,480,
320,"MSGraph.Chart",NULL,NULL,NULL,NULL,NULL,NULL));
COLEFormat oleformat(slideshape1.get_OLEFormat());
CChart objchart(oleformat.get_Object());
objchart.put_ChartType(-4102); // xl3dPie = -4102
}
//Build Slide #3:
{
//Add a text effect to the slide and apply shadows to
//the text effect.
//PowerPoint.PpSlideLayout.ppLayoutBlank = 12
CSlide pptSlide(pptSlides.Add(3,12));
pptSlide.put_FollowMasterBackground(FALSE);
CShapes slideshapes(pptSlide.get_Shapes());
CShape slideshape(slideshapes.AddTextEffect(26,"The End",
"Impact",96,FALSE, FALSE,239,200)); //msoTextEffect27 = 26
CShadowFormat objShadowFormat(slideshape.get_Shadow());
objShadowFormat.put_OffsetX(3);
objShadowFormat.put_OffsetY(3);
}
//Modify the slide show transition settings for all 3 slides in
//the presentation.
for(long count= 1; count <=3 ; count++)
{
COleVariant varindex(count);
CSlideRange objslideRange(pptSlides.Range(varindex));
CSlideShowTransition objSlideshowTransition(
objslideRange.get_SlideShowTransition());
objSlideshowTransition.put_AdvanceOnTime(TRUE);
objSlideshowTransition.put_AdvanceTime(3);
objSlideshowTransition.put_EntryEffect(3073); //ppEffectBoxOut = 3073
}
CSlideShowSettings objslideshowsettings(
pptPresentation.get_SlideShowSettings());
objslideshowsettings.put_StartingSlide(1);
objslideshowsettings.put_EndingSlide(3);
pdisptemp = objslideshowsettings.Run();
pdisptemp->Release();
pdisptemp = NULL;
//Run the slide show and wait for the slide show to end.
CSlideShowWindows objSlideShowWindows(pptApp.get_SlideShowWindows());
//Do some idle time processing while the show finishes.
while(objSlideShowWindows.get_Count() >= 1)
{
MSG msg;
if (PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
//Close the presentation without saving changes and quit PowerPoint.
pptPresentation.put_Saved(TRUE);
pptPresentation.Close();
pptApp.Quit();
}
}
Not Değiştir tam yolunu ve dosya adına bir PowerPoint işaret edecek biçimde strPresentationTemplate ve strPicture sabitler şablonu ve bir resim.
Oluşturmak ve bu programı çalıştırmak için F5 tuşuna basın.
PowerPoint'i başlatın, sunuyu oluşturun ve slayt gösterisini çalıştırmak için Run düğmesini tıklatın.
ÖNEMLİ: Bu makale, bir kişi tarafından çevrilmek yerine, Microsoft makine-çevirisi yazılımı ile çevrilmiştir. Microsoft size hem kişiler tarafından çevrilmiş, hem de makine-çevrisi ile çevrilmiş makaleler sunar. Böylelikle, bilgi bankamızdaki tüm makalelere, kendi dilinizde ulaşmış olursunuz. Bununla birlikte, makine tarafından çevrilmiş makaleler mükemmel değildir. Bir yabancının sizin dilinizde konuşurken yapabileceği hatalar gibi, makale; kelime dağarcığı, söz dizim kuralları veya dil bilgisi açısından yanlışlar içerebilir. Microsoft, içeriğin yanlış çevrimi veya onun müşteri tarafından kullanımından doğan; kusur, hata veya zarardan sorumlu değildir. Microsoft ayrıca makine çevirisi yazılımını sıkça güncellemektedir.
Makalenin İngilizcesi aşağıdaki gibidir:308336
(http://support.microsoft.com/kb/308336/en-us/
)
Bu makaleyi kullanmak için ne kadar kişisel çaba harcadınız?
Çok az
Az
Orta
Fazla
Çok fazla
Bu bilgiyi geliştirmemiz için nedenleri ve bu konuda neler yapabileceğimizi paylaşın
Teşekkürler! Görüşleriniz, destek içeriğimizi geliştirmemize yardımcı olmak için kullanılmaktadır. Diğer yardım seçenekleri için, lütfen Yardım ve Destek Giriş Sayfasını ziyaret edin.