Update of /cvsroot/mmclibrary/mmclibrary/MMCFormsShim
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5119
Modified Files:
MMCFormsShimCtrl.cpp MMCFormsShimCtrl.h
Log Message:
VK_ENTER is now passed through to the usercontrol
Index: MMCFormsShimCtrl.h
===================================================================
RCS file: /cvsroot/mmclibrary/mmclibrary/MMCFormsShim/MMCFormsShimCtrl.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** MMCFormsShimCtrl.h 16 Jan 2005 15:56:16 -0000 1.3
--- MMCFormsShimCtrl.h 17 Jan 2005 15:05:49 -0000 1.4
***************
*** 137,140 ****
--- 137,148 ----
STDMETHOD(RehostUserControl)(IUnknown *pControlObject);
+ virtual BOOL PreTranslateAccelerator(LPMSG pMsg, HRESULT& hRet);
+ STDMETHOD(TranslateAccelerator)(LPMSG pMsg);
+
+ STDMETHOD(get_FormClassName)(BSTR* pVal);
+ STDMETHOD(put_FormClassName)(BSTR newVal);
+ STDMETHOD(get_AssemblyName)(BSTR* pVal);
+ STDMETHOD(put_AssemblyName)(BSTR newVal);
+
protected:
***************
*** 142,156 ****
CComPtr<ICorRuntimeHost> m_pHost;
CComPtr<mscorlib::_AppDomain> m_pDefaultDomain;
! CComVariant m_varFormDisp;
! HWND m_hWndForm;
CComBSTR m_bstrAssemblyName; // path to the assemply to load
CComBSTR m_bstrClass; // class name of the form
! public:
! STDMETHOD(get_FormClassName)(BSTR* pVal);
! STDMETHOD(put_FormClassName)(BSTR newVal);
! STDMETHOD(get_AssemblyName)(BSTR* pVal);
! STDMETHOD(put_AssemblyName)(BSTR newVal);
};
--- 150,162 ----
CComPtr<ICorRuntimeHost> m_pHost;
CComPtr<mscorlib::_AppDomain> m_pDefaultDomain;
! CComVariant m_varFormDisp;
! HWND m_hWndForm;
!
! CComPtr<IUnknown> m_pUserControl;
CComBSTR m_bstrAssemblyName; // path to the assemply to load
CComBSTR m_bstrClass; // class name of the form
!
};
Index: MMCFormsShimCtrl.cpp
===================================================================
RCS file: /cvsroot/mmclibrary/mmclibrary/MMCFormsShim/MMCFormsShimCtrl.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** MMCFormsShimCtrl.cpp 16 Jan 2005 15:57:21 -0000 1.3
--- MMCFormsShimCtrl.cpp 17 Jan 2005 15:05:49 -0000 1.4
***************
*** 44,48 ****
/****
! * If we haven't already connected the hosted control, do it when the shim is shown.
***/
LRESULT CMMCFormsShimCtrl::OnShowWindow(UINT, WPARAM, LPARAM, BOOL&)
--- 44,48 ----
/****
! * connect to the host when the shim is shown.
***/
LRESULT CMMCFormsShimCtrl::OnShowWindow(UINT, WPARAM, LPARAM, BOOL&)
***************
*** 50,59 ****
// Inititalize a COM interface pointer
CComPtr<IUnknown> pUnk;
- // Reset();
! // FIXME MyVSUSerControlHostCtl is far cleaner
! // if the hosted control isn't connected, do it now
if (m_bstrAssemblyName.Length() && m_bstrClass.Length())
HRESULT hr = HostUserControl(m_bstrAssemblyName, m_bstrClass, &pUnk);
return 0;
}
--- 50,61 ----
// Inititalize a COM interface pointer
CComPtr<IUnknown> pUnk;
! // connect to the host
if (m_bstrAssemblyName.Length() && m_bstrClass.Length())
HRESULT hr = HostUserControl(m_bstrAssemblyName, m_bstrClass, &pUnk);
+
+ // store a pointer to the usercontrol interface
+ m_pUserControl = pUnk;
+
return 0;
}
***************
*** 71,77 ****
::MoveWindow(m_hWndForm, 0, 0, wLength, wHeight, TRUE);
! // FIXME lying ?
! // claim we didn't handle it (?)
! bHandled = FALSE;
return 0;
--- 73,78 ----
::MoveWindow(m_hWndForm, 0, 0, wLength, wHeight, TRUE);
! // we handled it
! bHandled = true;
return 0;
***************
*** 87,90 ****
--- 88,92 ----
m_varFormDisp.Clear();
m_hWndForm = NULL;
+ m_pUserControl = NULL;
}
***************
*** 197,200 ****
--- 199,228 ----
return hr;
}
+
+ BOOL CMMCFormsShimCtrl::PreTranslateAccelerator(LPMSG pMsg, HRESULT& hRet)
+ {
+ if(pMsg->message == WM_KEYDOWN)
+ {
+ switch(LOWORD(pMsg->wParam))
+ {
+ case VK_RETURN:
+ return ::SendMessage(m_hWndForm, pMsg->message, pMsg->wParam, pMsg->lParam) == 1;
+ }
+ }
+ return CComCompositeControl<CMMCFormsShimCtrl>::PreTranslateAccelerator(pMsg, hRet);
+ }
+
+ // The TranslateAccelerator method is proxied thru to the UserControl
+ // using its IOleInPlaceActiveObject interface
+ HRESULT CMMCFormsShimCtrl::TranslateAccelerator(LPMSG pMsg)
+ {
+ CComPtr<IOleInPlaceActiveObject> pIPAO;
+ if(m_pUserControl && m_pUserControl->QueryInterface(__uuidof(IOleInPlaceActiveObject), (LPVOID*)&pIPAO) == S_OK && (pIPAO.p))
+ if(pIPAO->TranslateAccelerator(pMsg) == S_OK)
+ return S_OK;
+
+ return IOleInPlaceActiveObjectImpl<CMMCFormsShimCtrl>::TranslateAccelerator(pMsg);
+ }
+
STDMETHODIMP CMMCFormsShimCtrl::get_FormClassName(BSTR* pVal)
{
|