m_oleObject->Close(OLECLOSE_NOSAVE);
m_oleObject->SetClientSite(NULL);
}
+
+ // Unregister object as active
+ RevokeActiveObject(m_pdwRegister, NULL);
}
void wxActiveX::CreateActiveX(REFCLSID clsid)
{
- SetTransparent();
-
HRESULT hret;
////////////////////////////////////////////////////////
wxCHECK_RET(adviseSink.Ok(), _T("adviseSink not Ok"));
- // // Create Object, get IUnknown interface
+ // Create Object, get IUnknown interface
m_ActiveX.CreateInstance(clsid, IID_IUnknown);
wxCHECK_RET(m_ActiveX.Ok(), _T("m_ActiveX.CreateInstance failed"));
+ // Register object as active
+ unsigned long pdwRegister;
+ hret = RegisterActiveObject(m_ActiveX, clsid, ACTIVEOBJECT_WEAK, &m_pdwRegister);
+ WXOLE_WARN(hret, "Unable to register object as active");
+
// Get Dispatch interface
hret = m_Dispatch.QueryInterface(IID_IDispatch, m_ActiveX);
WXOLE_WARN(hret, "Unable to get dispatch interface");
{
// cdecl call
// sometimes the pDispParams does not match the param info for a activex control
- int nArg = min(func.params.size(), pDispParams->cArgs);
+ int nArg = wxMin(func.params.size(), pDispParams->cArgs);
for (int i = nArg - 1; i >= 0; i--)
{
VARIANTARG& va = pDispParams->rgvarg[i];
if (func.hasOut)
{
- int nArg = min(func.params.size(), pDispParams->cArgs);
+ int nArg = wxMin(func.params.size(), pDispParams->cArgs);
m_activeX->GetEventHandler()->ProcessEvent(event);
for (int i = 0; i < nArg; i++)
{
wxLogTrace(wxT(""),wxT("msg sent"));
}
+bool wxActiveX::MSWTranslateMessage(WXMSG *msg){
+
+ if (msg->message == WM_KEYDOWN){
+ HRESULT result = m_oleInPlaceActiveObject->TranslateAccelerator(msg);
+ return (result == S_OK);
+ }
+
+ return wxWindow::MSWTranslateMessage(msg);
+}
+
long wxActiveX::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
if (m_oleObjectHWND == NULL)