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. PreTranslate Message problem

PreTranslate Message problem

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorial
6 Posts 4 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.
  • _ Offline
    _ Offline
    _tasleem
    wrote on last edited by
    #1

    hi all, i have a class derived from CDialogImpl<>,i want to catch the Message WM_Keydown, and identify if that key is esc then dont close the dialog. i have managed to do that in MFC application using Pretranslate function but that function is not working in ATL class, i have tried to override DialogProc() but this function also not called, similaraly other option like CMessage::PreTranslateMessage and but same result these function are not called. how to get equalent of MFC's PreTranslateMessage() in this class.

    Regards. Tasleem Arif

    M S 2 Replies Last reply
    0
    • _ _tasleem

      hi all, i have a class derived from CDialogImpl<>,i want to catch the Message WM_Keydown, and identify if that key is esc then dont close the dialog. i have managed to do that in MFC application using Pretranslate function but that function is not working in ATL class, i have tried to override DialogProc() but this function also not called, similaraly other option like CMessage::PreTranslateMessage and but same result these function are not called. how to get equalent of MFC's PreTranslateMessage() in this class.

      Regards. Tasleem Arif

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      What about overriding CDialogImpl::DialogProc()? Mark

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      _ 1 Reply Last reply
      0
      • _ _tasleem

        hi all, i have a class derived from CDialogImpl<>,i want to catch the Message WM_Keydown, and identify if that key is esc then dont close the dialog. i have managed to do that in MFC application using Pretranslate function but that function is not working in ATL class, i have tried to override DialogProc() but this function also not called, similaraly other option like CMessage::PreTranslateMessage and but same result these function are not called. how to get equalent of MFC's PreTranslateMessage() in this class.

        Regards. Tasleem Arif

        S Offline
        S Offline
        santhoshv84
        wrote on last edited by
        #3

        You can Override OnCancel(); Like this!. void YourClassName::OnCancel() { // TODO: Add your specialized code here and/or call the base class CDialog::OnCancel(); }

        Thanks and Regards. SANTHOSH V

        C 1 Reply Last reply
        0
        • S santhoshv84

          You can Override OnCancel(); Like this!. void YourClassName::OnCancel() { // TODO: Add your specialized code here and/or call the base class CDialog::OnCancel(); }

          Thanks and Regards. SANTHOSH V

          C Offline
          C Offline
          chandu004
          wrote on last edited by
          #4

          as suggested by santosh, you can override it or comment the following code //CDialog::OnCancel();

          1 Reply Last reply
          0
          • M Mark Salsbery

            What about overriding CDialogImpl::DialogProc()? Mark

            Mark Salsbery Microsoft MVP - Visual C++ :java:

            _ Offline
            _ Offline
            _tasleem
            wrote on last edited by
            #5

            i override that function but did not worked either. here was code i was using static virtual LRESULT CALLBACK DialogProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam); LRESULT CMiniBubbleDialog::DialogProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) { WriteEventLog1("Proc called"); switch(uMsg) { case WM_MOVE: WriteEventLog1("Mouse is moved"); break; case WM_LBUTTONDOWN: WriteEventLog1("Lbutton Down"); } return 0; } but did not worked.

            Regards. Tasleem Arif

            M 1 Reply Last reply
            0
            • _ _tasleem

              i override that function but did not worked either. here was code i was using static virtual LRESULT CALLBACK DialogProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam); LRESULT CMiniBubbleDialog::DialogProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) { WriteEventLog1("Proc called"); switch(uMsg) { case WM_MOVE: WriteEventLog1("Mouse is moved"); break; case WM_LBUTTONDOWN: WriteEventLog1("Lbutton Down"); } return 0; } but did not worked.

              Regards. Tasleem Arif

              M Offline
              M Offline
              Mark Salsbery
              wrote on last edited by
              #6

              Maybe override CDialogImpl::GetDialogProc() and return a pointer to your dialog proc. Mark

              Mark Salsbery Microsoft MVP - Visual C++ :java:

              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