Howto detect IE's "STOP" button click in my ActiveX Control ?

wujp1976 2001-05-27 12:57:00
For some ActiveX controls, such as ActiveMovie, the Stop button in the toolbar of the Internet Explorer has special meaning to them. Those controls may want to stop playing the background sound or movie when the Stop button is clicked.
Howto detect IE's "STOP" button click in my ActiveX Control ?
...全文
90 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
wujp1976 2001-06-05
  • 打赏
  • 举报
回复
oh ,why? only check it !
thank everyone!
wujp1976 2001-06-05
  • 打赏
  • 举报
回复
go
wujp1976 2001-06-01
  • 打赏
  • 举报
回复
up
wujp1976 2001-06-01
  • 打赏
  • 举报
回复

come on

everybody

can you help me ?
wujp1976 2001-05-29
  • 打赏
  • 举报
回复
do you have other way ?

coolstar 2001-05-27
  • 打赏
  • 举报
回复


ActiveX controls typically do not support the IOleCommandTarget interface.
For ActiveX controls that support IOleCommandTarget interface,
you must add the following code to the .h and .cpp files of the COleControl-derived class.
Then, you can trap the OLECMDID_STOP command id (id for the Stop button in Internet Explorer's toolbar) in the IOleCommandTarget::Exec()function.


// In the .h file of COleControl-derived class:
class CMyOleControl : public COleControl
{
...

// Interface Maps
protected:

// Add the following to support the IOleCommandTarget interface.
// NOTE: Nested class name is called CmdTargetObj
DECLARE_INTERFACE_MAP()

BEGIN_INTERFACE_PART(CmdTargetObj, IOleCommandTarget)
STDMETHOD(QueryStatus)(const GUID*, ULONG, OLECMD[], OLECMDTEXT*);
STDMETHOD(Exec)(const GUID*, DWORD, DWORD, VARIANTARG*,
VARIANTARG*);
END_INTERFACE_PART(CmdTargetObj)
};


// In the .cpp file of COleControl-derived class:
BEGIN_INTERFACE_MAP(CMyOleControl, COleControl)
INTERFACE_PART(CMyOleControl, IID_IOleCommandTarget, CmdTargetObj)
END_INTERFACE_MAP()

ULONG FAR EXPORT CMyOleControl::XCmdTargetObj::AddRef()
{
METHOD_PROLOGUE(CMyOleControl, CmdTargetObj)
return pThis->ExternalAddRef();
}

ULONG FAR EXPORT CMyOleControl::XCmdTargetObj::Release()
{
METHOD_PROLOGUE(CMyOleControl, CmdTargetObj)
return pThis->ExternalRelease();
}

HRESULT FAR EXPORT CMyOleControl::XCmdTargetObj::QueryInterface(
REFIID iid, void FAR* FAR* ppvObj)
{
METHOD_PROLOGUE(CMyOleControl, CmdTargetObj)
return (HRESULT)pThis->ExternalQueryInterface(&iid, ppvObj);
}

STDMETHODIMP CMyOleControl::XCmdTargetObj::QueryStatus(
const GUID* pguidCmdGroup, ULONG cCmds, OLECMD rgCmds[],
OLECMDTEXT* pcmdtext)
{
METHOD_PROLOGUE(CMyOleControl, CmdTargetObj)
//... add YOUR own code here.

return S_OK;
}

STDMETHODIMP CMyOleControl::XCmdTargetObj::Exec(
const GUID* pguidCmdGroup, DWORD nCmdID, DWORD nCmdExecOpt,
VARIANTARG* pvarargIn, VARIANTARG* pvarargOut)
{
METHOD_PROLOGUE(CMyOleControl, CmdTargetObj)
if (nCmdID == OLECMDID_STOP)
{
// ... STOP button is clicked, add YOUR own code here.
// We just display a message box.
::MessageBox(NULL, "STOP","CMyOleControl", MB_OK);
}

return S_OK;
}


4,387

社区成员

发帖
与我相关
我的任务
社区描述
通信技术相关讨论
社区管理员
  • 网络通信
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧