flash播放器嵌入在ASP网页这是在WebBrowser控件打开 [英] flash player embedded in asp page which is opened in webbrowser control
问题描述
我正在开发的C#.NET Windows应用程序。在我的WinForm的一个我加了WebBrowser控件。在这个WebBrowser控件我已经从我的本地网站上开设了一个ASP页。现在,在这个网页上有是用于播放SWF文件中的一个flash对象。 现在我的问题是,我可以访问我的winform这个控制?如果是这样的话怎么办? u能创建一个处理程序的Flash对象?
I am developing a windows application in C#.NET. In one of my winform I have added a WebBrowser control. In this webbrowser control I have opened an asp page from my local website. Now in this webpage there is one flash object which is used to play swf files. Now my question is can I access this control from my winform? If so then how? can u create a handler for that flash object?
推荐答案
您可以通过IHTMLObjectElement ::对象方法访问的ActiveX的脚本接口的元素。在microsoft.public.inetsdk.programming.webbrowser_ctl新闻组搜索IShockwaveFlash更多这方面的信息。
You can access the ActiveX's scripting interface from the element via the IHTMLObjectElement::object method. Search IShockwaveFlash in the microsoft.public.inetsdk.programming.webbrowser_ctl newsgroup for more information on this.
如果您使用的是Windows窗体,HTML元素的接口通过的 HtmlElement.DomElement 。您可以添加引用microsoft.mshtml并投DomElement到IHTMLObjectElement,然后获取它的对象属性和转换为IShockwaveFlash。
If you are using Windows Forms, html element's interface is exposed via HtmlElement.DomElement. You can add a reference to microsoft.mshtml and cast DomElement to IHTMLObjectElement, then obtain its object property and cast to IShockwaveFlash.
在ATL的code看起来像这样
In ATL the code looks like this
#import "flash.dll" raw_interfaces_only
CComPtr<IDispatch> htmlElement;
CComPtr<IDispatch> activeXObject;
hr = GetElement(elementIdString, &htmlElement);
if (htmlElement!= NULL)
{
CComQIPtr<IHTMLObjectElement> htmlObjectElement(htmlElement);
if (htmlObjectElement!= NULL)
{
htmlObjectElement->get_object(&activeXObject);
CComQIPtr<ShockwaveFlashObjects::IShockwaveFlash, &IID_IUnknown> flashViewer(spdispActiveXObject);
if(flashViewer!=NULL)
{
//do something on the flash
CComBSTR movie;
flashViewer->get_Movie(&movie);
}
}
}
这篇关于flash播放器嵌入在ASP网页这是在WebBrowser控件打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!