here is part of my header file. Everything works except the buttonup message: I do not know what the little smirky faces mean. There is a close parenthesis where each of the icons appear. What is the correct syntax?
// HTMLViewer.h : Declaration of the CHTMLViewer
#ifndef __HTMLVIEWER_H_
#define __HTMLVIEWER_H_
#include "resource.h" // main symbols
#include "VOImage.h"
#include <Atlbase.h>
#include <atlctl.h>
#include <htmlctrl.h>
#include<comdef.h> //for bstr conversion
#include<atlconv.h> //for uses conversion t2bstr
#include <stdlib.h> //for conversion
#include "HTMLControlCP.h"
/////////////////////////////////////////////////////////////////////////////
// CHTMLViewer
class ATL_NO_VTABLE CHTMLViewer :
public CComObjectRootEx<CComSingleThreadModel>,
public IDispatchImpl<IHTMLViewer, &IID_IHTMLViewer, &LIBID_HTMLCONTROLLib>,
public CComControl<CHTMLViewer>,
public IPersistStreamInitImpl<CHTMLViewer>,
public IOleControlImpl<CHTMLViewer>,
public IOleObjectImpl<CHTMLViewer>,
public IOleInPlaceActiveObjectImpl<CHTMLViewer>,
public IViewObjectExImpl<CHTMLViewer>,
public IOleInPlaceObjectWindowlessImpl<CHTMLViewer>,
public IConnectionPointContainerImpl<CHTMLViewer>,
public IPersistStorageImpl<CHTMLViewer>,
public ISpecifyPropertyPagesImpl<CHTMLViewer>,
public IQuickActivateImpl<CHTMLViewer>,
public IDataObjectImpl<CHTMLViewer>,
public IProvideClassInfo2Impl<&CLSID_HTMLViewer, &DIID__IHTMLViewerEvents, &LIBID_HTMLCONTROLLib>,
public IPropertyNotifySinkCP<CHTMLViewer>,
public CComCoClass<CHTMLViewer, &CLSID_HTMLViewer>,
public CProxy_IHTMLViewerEvents<CHTMLViewer>
{
public:
CHTMLViewer
(
) : m_ctlHTMLViewer
(_T
("DISPLAYCLASS"
, this, 1
)
{
m_bWindowOnly = TRUE;
}
DECLARE_REGISTRY_RESOURCEID
(IDR_HTMLVIEWER
)
DECLARE_PROTECT_FINAL_CONSTRUCT
(
)
BEGIN_COM_MAP
(CHTMLViewer
)
COM_INTERFACE_ENTRY
(IHTMLViewer
)
COM_INTERFACE_ENTRY
(IDispatch
)
COM_INTERFACE_ENTRY
(IViewObjectEx
)
COM_INTERFACE_ENTRY
(IViewObject2
)
COM_INTERFACE_ENTRY
(IViewObject
)
COM_INTERFACE_ENTRY
(IOleInPlaceObjectWindowless
)
COM_INTERFACE_ENTRY
(IOleInPlaceObject
)
COM_INTERFACE_ENTRY2
(IOleWindow, IOleInPlaceObjectWindowless
)
COM_INTERFACE_ENTRY
(IOleInPlaceActiveObject
)
COM_INTERFACE_ENTRY
(IOleControl
)
COM_INTERFACE_ENTRY
(IOleObject
)
COM_INTERFACE_ENTRY
(IPersistStreamInit
)
COM_INTERFACE_ENTRY2
(IPersist, IPersistStreamInit
)
COM_INTERFACE_ENTRY
(IConnectionPointContainer
)
COM_INTERFACE_ENTRY_IMPL
(IConnectionPointContainer
) //I added
COM_INTERFACE_ENTRY
(ISpecifyPropertyPages
)
COM_INTERFACE_ENTRY
(IQuickActivate
)
COM_INTERFACE_ENTRY
(IPersistStorage
)
COM_INTERFACE_ENTRY
(IDataObject
)
COM_INTERFACE_ENTRY
(IProvideClassInfo
)
COM_INTERFACE_ENTRY
(IProvideClassInfo2
)
END_COM_MAP
(
)
BEGIN_PROP_MAP
(CHTMLViewer
)
PROP_DATA_ENTRY
("_cx", m_sizeExtent.cx, VT_UI4
)
PROP_DATA_ENTRY
("_cy", m_sizeExtent.cy, VT_UI4
)
//PROP_ENTRY
("BorderVisible", DISPID_BORDERVISIBLE, CLSID_NULL
)
// Example entries
// PROP_ENTRY
("Property Description", dispid, clsid
)
// PROP_PAGE
(CLSID_StockColorPage
)
END_PROP_MAP
(
)
BEGIN_CONNECTION_POINT_MAP
(CHTMLViewer
)
CONNECTION_POINT_ENTRY
(IID_IPropertyNotifySink
)
CONNECTION_POINT_ENTRY
(DIID__IHTMLViewerEvents
)
//CONNECTION_POINT_ENTRY
(IID__IHTMLViewerEvents
)
// CONNECTION_POINT_ENTRY
(IID__IHTMLViewerEvents
)
END_CONNECTION_POINT_MAP
(
)
BEGIN_MSG_MAP
(CHTMLViewer
)
MESSAGE_HANDLER
(WM_CREATE, OnCreate
)
MESSAGE_HANDLER
(WM_SETFOCUS, OnSetFocus
)
MESSAGE_HANDLER
(WM_NOTIFY, OnNotify
)
MESSAGE_HANDLER
(WM_LBUTTONUP, OnLButtonUp
)
CHAIN_MSG_MAP
(CComControl<CHTMLViewer>
ALT_MSG_MAP
(1
)
// Replace this with message map entries for superclassed ListBox
END_MSG_MAP
(
)
// Handler prototypes:
// LRESULT MessageHandler
(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled
);
// LRESULT CommandHandler
(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled
);
// LRESULT NotifyHandler
(int idCtrl, LPNMHDR pnmh, BOOL& bHandled
);
BOOL PreTranslateAccelerator
(LPMSG pMsg, HRESULT& hRet
)
{
if
(pMsg->message == WM_KEYDOWN &&
(pMsg->wParam == VK_LEFT ||
pMsg->wParam == VK_RIGHT ||
pMsg->wParam == VK_UP ||
pMsg->wParam == VK_DOWN
)
)
{
hRet = S_FALSE;
return TRUE;
}
//TODO: Add your additional accelerator handling code here
return FALSE;
}
//THIS WORKS
LRESULT OnSetFocus
(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled
)
{
LRESULT lRes = CComControl<CHTMLViewer>:: OnSetFocus
(uMsg, wParam, lParam, bHandled
);
if
(m_bInPlaceActive
)
{
DoVerbUIActivate
(&m_rcPos, NULL
);
if
(!IsChild
(::GetFocus
(
)
)
)
{
m_ctlHTMLViewer.SetFocus
(
);
}
}
return lRes;
}
//THIS WORKS
LRESULT OnCreate
(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/
)
{
RECT rc;
LoadLibrary
(_T
("htmlview.dll"
);
InitHTMLControl
(_Module.m_hInst
);
GetWindowRect
(&rc
);
rc.right -= rc.left;
rc.bottom -= rc.top;
rc.top = rc.left = 0;
m_ctlHTMLViewer.Create
(m_hWnd, rc, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_BORDER
);
return 0;
}
//This is the WM_NOTIFY HANDLER. IT WORKS
LRESULT OnNotify
(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled
)
{
NM_HTMLVIEW* pnm =
(NM_HTMLVIEW*
)lParam;
LPNMHDR pnmh =
(LPNMHDR
) &
(pnm->hdr
);
switch
(pnmh->code
)
{
//----------------------------------------------------------------------------
//This notification message is sent by the Windows HTML viewer control when the
//user taps on a link or submits a form.
//----------------------------------------------------------------------------
case NM_HOTSPOT:
{
//this code successfully causes the LinkSelect Event
//to fire in my vb app so I know the wm_notify handler
//works.
USES_CONVERSION;
LPTSTR temp;
temp=
(LPTSTR
)
(pnm->szTarget
);
g_StrongsNumber=T2BSTR
(temp
);
Fire_LinkSelect
(1,1,2
);
break;
}
}
return 0;
} // end OnNotify
//THis is the WM_LBUTTONUP HANDLER. DOES NOT WORK
LRESULT OnLButtonUp
(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled
)
// If the message is received an event will fire in my vb app, but it
//doesn't fir
Fire_LinkSelect
(1,1,2
);
return 0;
}
//tHERE IS MORE BUT i DID NOT INCLUDE.....
};
#endif //__HTMLVIEWER_H_