Microsoft Visual Studio .NET ile Temsilciler olayları PowerPoint'le batar kullanamazsınız. PowerPoint, olayları ba?latmak için ıdispatch arabirimini kullanır. Doğru olayları batar için <a0></a0>, Visual Basic .NET uygulama IConnectionPointContainer ve IConnectionPoint arabirimleri'ni kullanmanız gerekir. Alıcı uygulama batar DISPIDs olayları da bilmeniz gerekir. Bu DISPIDs PowerPoint'ın Tür kitaplığında listelenir, ancak başvuru için örnek kodu listelenir.
Örnek Visual Basic .NET Otomasyon istemciye oluşturun
Microsoft Visual Studio .NET'i başlatın. Dosya menüsünde Yeni'yi tıklatın ve Project ' ı tıklatın. Proje türleri altında) Visual Basic Projects ' ı tıklatın ve şablonları altında Windows uygulaması ' ı tıklatın. Varsayılan olarak, Form1 oluşturulur.
Microsoft PowerPoint nesne kitaplığına bir başvuru ekleyin. Bunu yapmak için şu adımları izleyin:
Proje) menüsünde Add Reference ' ı tıklatın.
COM sekmesinde, Microsoft PowerPoint 10.0 Nesne Kitaplığı ' nı bulun ve sonra da <a2>Seç</a2>'i tıklatın. Not: önceden yapmadıysanız, karşıdan yükleyin ve sonra Microsoft Office XP Primary ınterop Assemblies yüklemeniz önerilir (Pıa). Office XP Pıa hakkında'ek bilgi için Microsoft Knowledge Base'deki makaleyi görüntülemek üzere aşağıdaki makale numarasını tıklatın:
BILGI: Microsoft Office XP Pıa yükleme için kullanılabilir
Seçiminizi kabul etmek için Tamam <a0>Başvuru Ekle</a0> iletişim kutusunda tıklatın. Seçtiğiniz kitaplıklar için sar?c?lar? oluşturmak isteyen bir ileti alırsanız, Evet ' i tıklatın.
Görünüm menüsünden araç kutusunu görüntülemek ve Form1'e, iki düğme ve bir liste kutusu eklemek için araç ' ı tıklatın.
Sırayla Button1Button2 ve Form1 ' ni çift tıklatın.
Kod penceresinde aşağıdaki kodu
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
End Sub
ile:
Private m_oConnectionPoint As UCOMIConnectionPoint
Private m_Cookie As Integer
Private oPPT As PowerPoint.Application
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
' Create a new instance of PowerPoint.
oPPT = New PowerPoint.Application()
' Show PowerPoint to the user.
oPPT.Visible = Microsoft.Office.Core.MsoTriState.msoTrue
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
' Call Unadvise to remove the sink to the connection.
m_oConnectionPoint.Unadvise(m_Cookie)
System.Runtime.InteropServices.Marshal.ReleaseComObject(oPPT)
GC.Collect()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim oConnPointContainer As UCOMIConnectionPointContainer
' QI for IConnectionPointContainer.
oConnPointContainer = CType(oPPT, UCOMIConnectionPointContainer)
' Create a new variable that contains the GUID of the
' PowerPoint.EApplication interface.
Dim guid As New Guid("914934C2-5A91-11CF-8700-00AA0060263B")
' Find the connection point.
oConnPointContainer.FindConnectionPoint(guid, m_oConnectionPoint)
' Call Advise to sink up the connection.
m_oConnectionPoint.Advise(Me, m_Cookie)
End Sub
<DispId(2001)> Public Sub WindowSelectionChange(ByVal Sel As PowerPoint.Selection)
Me.ListBox1.Items.Add("WindowSelectionChange")
End Sub
<DispId(2002)> Public Sub WindowBeforeRightClick(ByVal Sel As PowerPoint.Selection,
ByVal Cancel As Boolean)
Me.ListBox1.Items.Add("WindowBeforeRightClick")
End Sub
<DispId(2003)> Public Sub WindowBeforeDoubleClick(ByVal Sel As PowerPoint.Selection,
ByVal Cancel As Boolean)
Me.ListBox1.Items.Add("WindowBeforeDoubleClick")
End Sub
<DispId(2004)> Public Sub PresentationClose(ByVal Pres As PowerPoint.Presentation)
Me.ListBox1.Items.Add("PresentationClose")
End Sub
<DispId(2005)> Public Sub PresentationSave(ByVal Pres As PowerPoint.Presentation)
Me.ListBox1.Items.Add("PresentationSave")
End Sub
<DispId(2006)> Public Sub PresentationOpen(ByVal Pres As PowerPoint.Presentation)
Me.ListBox1.Items.Add("PresentationOpen")
End Sub
<DispId(2007)> Public Sub NewPresentation(ByVal Pres As PowerPoint.Presentation)
Me.ListBox1.Items.Add("NewPresentation")
End Sub
<DispId(2008)> Public Sub PresentationNewSlide(ByVal Sld As PowerPoint.Slide)
Me.ListBox1.Items.Add("PresentationNewSlide")
End Sub
<DispId(2009)> Public Sub WindowActivate(ByVal Pres As PowerPoint.Presentation,
ByVal Wn As PowerPoint.DocumentWindow)
Me.ListBox1.Items.Add("WindowActivate")
End Sub
<DispId(2010)> Public Sub WindowDeactivate(ByVal Pres As PowerPoint.Presentation,
ByVal Wn As PowerPoint.DocumentWindow)
Me.ListBox1.Items.Add("WindowDeactivate")
End Sub
<DispId(2011)> Public Sub SlideShowBegin(ByVal Wn As PowerPoint.SlideShowWindow)
Me.ListBox1.Items.Add("SlideShowBegin")
End Sub
<DispId(2012)> Public Sub SlideShowNextBuild(ByVal Wn As PowerPoint.SlideShowWindow)
Me.ListBox1.Items.Add("SlideShowNextBuild")
End Sub
<DispId(2013)> Public Sub SlideShowNextSlide(ByVal Wn As PowerPoint.SlideShowWindow)
Me.ListBox1.Items.Add("SlideShowNextSlide")
End Sub
<DispId(2014)> Public Sub SlideShowEnd(ByVal Pres As PowerPoint.Presentation)
Me.ListBox1.Items.Add("SlideShowEnd")
End Sub
<DispId(2015)> Public Sub PresentationPrint(ByVal Pres As PowerPoint.Presentation)
Me.ListBox1.Items.Add("PresentationPrint")
End Sub
<DispId(2016)> Public Sub SlideSelectionChanged(ByVal SldRange As PowerPoint.SlideRange)
Me.ListBox1.Items.Add("SlideSelectionChanged")
End Sub
<DispId(2017)> Public Sub ColorSchemeChanged(ByVal SldRange As PowerPoint.SlideRange)
Me.ListBox1.Items.Add("ColorSchemeChanged")
End Sub
<DispId(2018)> Public Sub PresentationBeforeSave(ByVal Pres As PowerPoint.Presentation,
ByVal Cancel As Boolean)
Me.ListBox1.Items.Add("PresentationBeforeSave")
End Sub
<DispId(2019)> Public Sub SlideShowNextClick(ByVal Wn As PowerPoint.SlideShowWindow,
ByVal nEffect As PowerPoint.Effect)
Me.ListBox1.Items.Add("SlideShowNextClick")
End Sub
Makale numarası: 308330 - Son Gözden Geçirme: 30 Ocak 2007 Salı - Gözden geçirme: 4.3
Bu makaledeki bilginin uygulandığı durum:
Microsoft PowerPoint 2002 Standard Edition
Microsoft Visual Basic .NET 2002 Standard Edition
Anahtar Kelimeler:
kbmt kbautomation kbhowto KB308330 KbMttr
Otomatik Tercüme
Ö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.
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.