Help! about PreTranslateMessage in a COM DLL
-
Hi: I meet a problem, it has puzzled me for a long time. I create a COM dll which support MFC, several methods was exposured. The implement code of two methods was shown as follow:
STDMETHODIMP CMyComObj::OnConfiguration(long iReserved, BOOL *pbSuccess) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) CMyCfgDlg dlg; int rtn = dlg.DoModal(); *pbSuccess = (rtn == IDOK) ? TRUE : FALSE; return S_OK; } STDMETHODIMP CMyComObj::ShowUIFace(long hParentWnd) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) // declare in header file as CMyUIDlg *pdlg; pdlg = new CMyUIDlg(); if(pdlg != NULL) { pdlg->Create(ID_MYUIDLG,CWnd::Fromhandle((HWND)hParentWnd));//Create success } *pbSuccess = (rtn == IDOK) ? TRUE : FALSE; return S_OK; }
The problem is in the first method call, the dialog shown normal and I can use TAB switch focus from one control to another control. When I use the second method call, the dialog shown normal but can't use TAB to switch focus(It does not take effect). The reason is virtual function PreTranslateMessage was not be processed, What's wrong? I want "PreTranslateMessage" be called normally.Please help me!!! I am seeking... For what? Why did you ask me for what? I don't know! -
Hi: I meet a problem, it has puzzled me for a long time. I create a COM dll which support MFC, several methods was exposured. The implement code of two methods was shown as follow:
STDMETHODIMP CMyComObj::OnConfiguration(long iReserved, BOOL *pbSuccess) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) CMyCfgDlg dlg; int rtn = dlg.DoModal(); *pbSuccess = (rtn == IDOK) ? TRUE : FALSE; return S_OK; } STDMETHODIMP CMyComObj::ShowUIFace(long hParentWnd) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) // declare in header file as CMyUIDlg *pdlg; pdlg = new CMyUIDlg(); if(pdlg != NULL) { pdlg->Create(ID_MYUIDLG,CWnd::Fromhandle((HWND)hParentWnd));//Create success } *pbSuccess = (rtn == IDOK) ? TRUE : FALSE; return S_OK; }
The problem is in the first method call, the dialog shown normal and I can use TAB switch focus from one control to another control. When I use the second method call, the dialog shown normal but can't use TAB to switch focus(It does not take effect). The reason is virtual function PreTranslateMessage was not be processed, What's wrong? I want "PreTranslateMessage" be called normally.Please help me!!! I am seeking... For what? Why did you ask me for what? I don't know!