S
sam_sam80
Hi,
I did PowerPoint automation winthin Webbrowser Control. I can
open .ppt file and browse the slides.
My problem is when I have an other session of PPT open outside the
Webbrowser control I losse the control of my own file.
//opning PPT file
object messing = System.Reflection.Missing.Value;
string filepath = "....."
this.axWebBrowser1.Navigate(filepath, ref messing, ref messing, ref
messing, ref messing);
private void axWebBrowser1_DocumentComplete(object sender,
AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
{
opDisp = e.pDisp;
oDocument =
opDisp.GetType().InvokeMember("Document",BindingFlags.GetProperty,null,opDisp,null);
oApplication =
opDisp.GetType().InvokeMember("Application",BindingFlags.GetProperty,null,oDocument,null);
Object oPresentation =
opDisp.GetType().InvokeMember("ActivePresentation",BindingFlags.GetProperty,
null, oApplication, null);
Object oSlides =
opDisp.GetType().InvokeMember("Slides",BindingFlags.GetProperty, null,
oPresentation, null);
this.slideCount = (int)
(opDisp.GetType().InvokeMember("Count",BindingFlags.GetProperty, null,
oSlides, null));
Object oSlideShowWindow =
opDisp.GetType().InvokeMember("SlideShowWindow",BindingFlags.GetProperty,
null, oPresentation, null);
Object oSSWView =
opDisp.GetType().InvokeMember("View",BindingFlags.GetProperty, null,
oSlideShowWindow, null);
// PowerPoint Application object
PowerPoint.Application pptApplication =
(PowerPoint.Application)oApplication;
pptApplication.SlideShowNextBuild +=new
PowerPoint.EApplication_SlideShowNextBuildEventHandler(pptApplication_SlideShowNextBuild);
pptApplication.SlideShowNextSlide +=new
PowerPoint.EApplication_SlideShowNextSlideEventHandler(pptApplication_SlideShowNextSlide);
pptApplication.SlideShowNextClick +=new
PowerPoint.EApplication_SlideShowNextClickEventHandler(pptApplication_SlideShowNextClick);
}
I did PowerPoint automation winthin Webbrowser Control. I can
open .ppt file and browse the slides.
My problem is when I have an other session of PPT open outside the
Webbrowser control I losse the control of my own file.
//opning PPT file
object messing = System.Reflection.Missing.Value;
string filepath = "....."
this.axWebBrowser1.Navigate(filepath, ref messing, ref messing, ref
messing, ref messing);
private void axWebBrowser1_DocumentComplete(object sender,
AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
{
opDisp = e.pDisp;
oDocument =
opDisp.GetType().InvokeMember("Document",BindingFlags.GetProperty,null,opDisp,null);
oApplication =
opDisp.GetType().InvokeMember("Application",BindingFlags.GetProperty,null,oDocument,null);
Object oPresentation =
opDisp.GetType().InvokeMember("ActivePresentation",BindingFlags.GetProperty,
null, oApplication, null);
Object oSlides =
opDisp.GetType().InvokeMember("Slides",BindingFlags.GetProperty, null,
oPresentation, null);
this.slideCount = (int)
(opDisp.GetType().InvokeMember("Count",BindingFlags.GetProperty, null,
oSlides, null));
Object oSlideShowWindow =
opDisp.GetType().InvokeMember("SlideShowWindow",BindingFlags.GetProperty,
null, oPresentation, null);
Object oSSWView =
opDisp.GetType().InvokeMember("View",BindingFlags.GetProperty, null,
oSlideShowWindow, null);
// PowerPoint Application object
PowerPoint.Application pptApplication =
(PowerPoint.Application)oApplication;
pptApplication.SlideShowNextBuild +=new
PowerPoint.EApplication_SlideShowNextBuildEventHandler(pptApplication_SlideShowNextBuild);
pptApplication.SlideShowNextSlide +=new
PowerPoint.EApplication_SlideShowNextSlideEventHandler(pptApplication_SlideShowNextSlide);
pptApplication.SlideShowNextClick +=new
PowerPoint.EApplication_SlideShowNextClickEventHandler(pptApplication_SlideShowNextClick);
}