如何下沉浏览器事件 [英] How to sink browser event

查看:88
本文介绍了如何下沉浏览器事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我已经开发了一个Internet Explorer工具栏,在其中我想要不同的事件,例如任何用户提交任何表单详细信息时的事件,如何通过进行一些R& D来跟踪该事件,我知道我必须沉没事件,通过实现iDispatch iterface,但我无法做到这一点,任何人都可以帮助我.
谢谢

Hi I have developed a Internet explorer toolbar in which i want different ie events like when any user submit any form details ,how can i trace that event ,by doing some R&D i came to know that i have to sink event,By implementing iDispatch iterface but i am not able to do that can anyone help me out in that .
Thanks

推荐答案

如果您使用Visual Studio向导将Web浏览器控件插入对话框资源中,则可以使用向导来处理事件.

如果已动态创建控件,则需要执行以下操作:

1.在父对话框类的h文件中,添加以下宏:
If you used the Visual Studio Wizard to insert the Web Browser control to the dialog resource you will be able to use the Wizard to process the events.

If you have created the control dynamically, you need to do the following:

1. In the h file of the parent dialog class add this macro:
DECLARE_EVENTSINK_MAP()



2.在cpp文件中添加以下内容:



2. In the cpp file add this:

BEGIN_EVENTSINK_MAP(CTestProjectDlg, CDialog)
END_EVENTSINK_MAP()



使用这些宏,您将定义活动X控件的事件接收器,该控件将放置在对话框中.

现在,您需要在h文件中声明事件处理程序,在cpp文件中创建其实现,然后使用ON_EVEN宏对其进行映射.

例如,对于NavigateComplete2,您将具有以下内容:

在h文件中:



Using these macros you will define the event sink for active X controls that will be placed in the dialog.

Now you need to declare the event handler in the h file, create its implementation in the cpp file, and map it using ON_EVEN macro.

For example, for NavigateComplete2 you would have these:

in the h file:

void NavigateComplete2Explorer1(LPDISPATCH pDisp, VARIANT* URL);



在cpp文件中:



in the cpp file:

BEGIN_EVENTSINK_MAP(CTestProjectDlg, CDialog)
  ON_EVENT(CTestProjectDlg, IDC_EXPLORER1, 252, CTestProjectDlg::NavigateComplete2Explorer1, VTS_DISPATCH VTS_PVARIANT)
END_EVENTSINK_MAP()

void CTestProjectDlg::NavigateComplete2Explorer1(LPDISPATCH pDisp, VARIANT* URL)
{
  // TODO: Add your message handler code here
}


如果使用Visual Studio向导将Web浏览器控件插入对话框资源中,则可以使用向导来处理事件.

如果已动态创建控件,则需要执行以下操作:

1.在父对话框类的h文件中,添加以下宏:
If you used the Visual Studio Wizard to insert the Web Browser control to the dialog resource you will be able to use the Wizard to process the events.

If you have created the control dynamically, you need to do the following:

1. In the h file of the parent dialog class add this macro:
DECLARE_EVENTSINK_MAP()



2.在cpp文件中添加以下内容:



2. In the cpp file add this:

BEGIN_EVENTSINK_MAP(CTestProjectDlg, CDialog)
END_EVENTSINK_MAP()



使用这些宏,您将定义活动X控件的事件接收器,该控件将放置在对话框中.

现在,您需要在h文件中声明事件处理程序,在cpp文件中创建其实现,然后使用ON_EVEN宏对其进行映射.

例如,对于NavigateComplete2,您将具有以下内容:

在h文件中:



Using these macros you will define the event sink for active X controls that will be placed in the dialog.

Now you need to declare the event handler in the h file, create its implementation in the cpp file, and map it using ON_EVEN macro.

For example, for NavigateComplete2 you would have these:

in the h file:

void NavigateComplete2Explorer1(LPDISPATCH pDisp, VARIANT* URL);



在cpp文件中:



in the cpp file:

BEGIN_EVENTSINK_MAP(CTestProjectDlg, CDialog)
  ON_EVENT(CTestProjectDlg, IDC_EXPLORER1, 252, CTestProjectDlg::NavigateComplete2Explorer1, VTS_DISPATCH VTS_PVARIANT)
END_EVENTSINK_MAP()

void CTestProjectDlg::NavigateComplete2Explorer1(LPDISPATCH pDisp, VARIANT* URL)
{
  // TODO: Add your message handler code here
}


如果使用Visual Studio向导将Web浏览器控件插入对话框资源中,则可以使用向导来处理事件.

如果已动态创建控件,则需要执行以下操作:

1.在父对话框类的h文件中,添加以下宏:
If you used the Visual Studio Wizard to insert the Web Browser control to the dialog resource you will be able to use the Wizard to process the events.

If you have created the control dynamically, you need to do the following:

1. In the h file of the parent dialog class add this macro:
DECLARE_EVENTSINK_MAP()



2.在cpp文件中添加以下内容:



2. In the cpp file add this:

BEGIN_EVENTSINK_MAP(CTestProjectDlg, CDialog)
END_EVENTSINK_MAP()



使用这些宏,您将定义活动X控件的事件接收器,该控件将放置在对话框中.

现在,您需要在h文件中声明事件处理程序,在cpp文件中创建其实现,然后使用ON_EVEN宏对其进行映射.

例如,对于NavigateComplete2,您将具有以下内容:

在h文件中:



Using these macros you will define the event sink for active X controls that will be placed in the dialog.

Now you need to declare the event handler in the h file, create its implementation in the cpp file, and map it using ON_EVEN macro.

For example, for NavigateComplete2 you would have these:

in the h file:

void NavigateComplete2Explorer1(LPDISPATCH pDisp, VARIANT* URL);



在cpp文件中:



in the cpp file:

BEGIN_EVENTSINK_MAP(CTestProjectDlg, CDialog)
  ON_EVENT(CTestProjectDlg, IDC_EXPLORER1, 252, CTestProjectDlg::NavigateComplete2Explorer1, VTS_DISPATCH VTS_PVARIANT)
END_EVENTSINK_MAP()

void CTestProjectDlg::NavigateComplete2Explorer1(LPDISPATCH pDisp, VARIANT* URL)
{
  // TODO: Add your message handler code here
}


这篇关于如何下沉浏览器事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆