Hi Everyone
I have written some code to manipulate DOM for IE browser. It uses ATL library to create COM. The DOM is by default manipulated OnDocumentComplete where more information is added to each link on the webpage. But I would like to insert a hotkey ctrl+alt+M. On pressing the hotkey the DOM needs to be manipulated. I am not too sure how to go about it. Below I have pasted my code:
DOMBHO.h
#pragma once
#include "resource.h" // main symbols
#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif
class ATL_NO_VTABLE CDOMBHO :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CDOMBHO, &CLSID_DOMBHO>,
public IObjectWithSiteImpl<CDOMBHO>,
public IDispatchImpl<IDOMBHO, &IID_IDOMBHO, &LIBID_DOMLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
public IDispEventImpl<1, CDOMBHO, &DIID_DWebBrowserEvents2, &LIBID_SHDocVw, 1, 1>
// Query for the IWebBrowser2 interface.
CComQIPtr<IWebBrowser2> spTempWebBrowser = pDisp;
// Is this event associated with the top-level browser?
if (spTempWebBrowser && m_spWebBrowser &&
m_spWebBrowser.IsEqualObject(spTempWebBrowser))
{
// Get the current document object from browser...
CComPtr<IDispatch> spDispDoc;
hr = m_spWebBrowser->get_Document(&spDispDoc);
if (SUCCEEDED(hr))
{
// ...and query for an HTML document.
CComQIPtr<IHTMLDocument2> spHTMLDoc = spDispDoc;
if (spHTMLDoc != NULL)
{
// Finally, remove the images.
Bookmarks