Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 25-Nov-12 3:33am
v3
Comments
bbirajdar 25-Nov-12 12:35pm    
Have you tried using water to sink it ?
Nelek 25-Nov-12 15:05pm    
evil... :laugh:

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:
C++
DECLARE_EVENTSINK_MAP()


2. In the cpp file add this:
C++
BEGIN_EVENTSINK_MAP(CTestProjectDlg, CDialog)
END_EVENTSINK_MAP()


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:
C++
void NavigateComplete2Explorer1(LPDISPATCH pDisp, VARIANT* URL);


in the cpp file:
C++
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
}
 
Share this answer
 
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:
C++
DECLARE_EVENTSINK_MAP()


2. In the cpp file add this:
C++
BEGIN_EVENTSINK_MAP(CTestProjectDlg, CDialog)
END_EVENTSINK_MAP()


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:
C++
void NavigateComplete2Explorer1(LPDISPATCH pDisp, VARIANT* URL);


in the cpp file:
C++
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
}
 
Share this answer
 
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:
C++
DECLARE_EVENTSINK_MAP()


2. In the cpp file add this:
C++
BEGIN_EVENTSINK_MAP(CTestProjectDlg, CDialog)
END_EVENTSINK_MAP()


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:
C++
void NavigateComplete2Explorer1(LPDISPATCH pDisp, VARIANT* URL);


in the cpp file:
C++
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
}
 
Share this answer
 
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:
C++
DECLARE_EVENTSINK_MAP()


2. In the cpp file add this:
C++
BEGIN_EVENTSINK_MAP(CTestProjectDlg, CDialog)
END_EVENTSINK_MAP()


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:
C++
void NavigateComplete2Explorer1(LPDISPATCH pDisp, VARIANT* URL);


in the cpp file:
C++
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
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900