Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Help! about PreTranslateMessage in a COM DLL

Help! about PreTranslateMessage in a COM DLL

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++comquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Simon W 0
    wrote on last edited by
    #1

    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!

    D 1 Reply Last reply
    0
    • S Simon W 0

      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!

      D Offline
      D Offline
      dabs
      wrote on last edited by
      #2

      Sorry, but PreTranslateMessage will not get called inside your dll. You'll have to find another way to do what you want.


      Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups