Problem setting connection point on Input Image type elements.
Posted by kamleshsoni1979
on 11/25/2004 09:49am
I modified the mshtmlhook demo code a bit to also add one more element in the html page loaded by the dialog. The element is Input image type. And the code added to the html page is .
I modified the code for CMshtmlhookDlg and added one more api for setting connection points on this Input Image element.
void CMshtmlhookDlg::ConnectImage(IHTMLInputImage* pImageElem)
HRESULT hr = 0;
IConnectionPointContainer* pCPC = NULL;
IConnectionPoint* pCP = NULL;
IUnknown* pUnk = NULL;
// Check that this is a connectable object.
hr = pImageElem->QueryInterface(IID_IConnectionPointContainer, (void**)&pCPC);
if (hr == S_OK)
// Find the connection point.
hr = pCPC->FindConnectionPoint(DIID_HTMLInputImageEvents, &pCP);
if (hr == S_OK)
//AfxMessageBox("Find connection point ");
// Advise the connection point.
// pUnk is the IUnknown interface pointer for your event sink
CDHTMLEventSink* pSink = new CDHTMLEventSink;
IUnknown* pUnk = pSink->GetInterface(&IID_IUnknown);
hr = pCP->Advise(pUnk, &dwCookie);
if(pCP == NULL)
AfxMessageBox("Find connection point input image elment failed");
But FindConnectionPoint(DIID_HTMLInputImageEvents, &pCP) api used above fails to find the connection point on Input Image Element. Can any one suggest any reason for this failure or is there any workaround for this. The connection points gets set properly for all the other kinds of html elements but for Input Image type. Please help.
Thanks and Regards,
My dear friend:
This program is very helpful for me. I can get the click event on my IHTMLInputButtonElement and Now I want to get the IHTMLInputButtonElement via IHTMLEventObj too,I tried many times,but all failed.Can anyone help me? Thank you for advance!
with this example i understand to capture mouse click on buttons, but i want detect mouse click down et mouse click up for all web page.
when someone selct text in the html document i want to know the mouse position when clisk down and the position when click up !
you know how to do this??
I noticed that the code you have works by having an application (exe) open a browser. Is it possible for an ActiveX control to do the same thing if it is embeded in an HTML page? When I have tried doing this I get a memory access violation. If this is possible, how do you do this? I have been trying to do this for weeks now and I can't get anywhere.
Hello everyone, I just downloaded the hook example and found it is pretty good! I have it modified and merge it into my project, much thanks to author!
I found there is a "mshtmlhook.odl" file in the example. I dont know what it is, I removed it from project and it works properly anyway, what I want to know about is what can this ODL file do? Will I meet some trouble in the future without the ODL file?