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. Re: trapping F1 in a class derived from CFileDialogImpl [modified]

Re: trapping F1 in a class derived from CFileDialogImpl [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
questioncsharpvisual-studiohelp
6 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.
  • M Offline
    M Offline
    mla154
    wrote on last edited by
    #1

    Hello, I'm using Visual Studio 2008 and I'm trying to trap the 'F1' key in a class derived from CFileDialogImpl (found in Windows Template Library 8.0).  I've tried a number of things including adding the function:

    LRESULT _OnHelp(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/)

    I've also tried adding the handlers WM_HELP and WM_KEYDOWN, but this doesn't work.  Lastly, I've done a number of searches on Google to try to find the answer, but I still haven't figured it out.  How do I trap the 'F1' key?  Any help or suggestions are appreciated.

    Regards, Mike

    modified on Tuesday, June 15, 2010 8:37 AM

    N 1 Reply Last reply
    0
    • M mla154

      Hello, I'm using Visual Studio 2008 and I'm trying to trap the 'F1' key in a class derived from CFileDialogImpl (found in Windows Template Library 8.0).  I've tried a number of things including adding the function:

      LRESULT _OnHelp(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/)

      I've also tried adding the handlers WM_HELP and WM_KEYDOWN, but this doesn't work.  Lastly, I've done a number of searches on Google to try to find the answer, but I still haven't figured it out.  How do I trap the 'F1' key?  Any help or suggestions are appreciated.

      Regards, Mike

      modified on Tuesday, June 15, 2010 8:37 AM

      N Offline
      N Offline
      Niklas L
      wrote on last edited by
      #2

      Try to trap it in your PreTranslateMessage()

      home

      M 1 Reply Last reply
      0
      • N Niklas L

        Try to trap it in your PreTranslateMessage()

        home

        M Offline
        M Offline
        mla154
        wrote on last edited by
        #3

        I know of no way to use PreTranslateMessage for the CFileDialogImpl class. If I'm wrong, please let me know. Regards, Mike

        N 1 Reply Last reply
        0
        • M mla154

          I know of no way to use PreTranslateMessage for the CFileDialogImpl class. If I'm wrong, please let me know. Regards, Mike

          N Offline
          N Offline
          Niklas L
          wrote on last edited by
          #4

          Ah sorry, got a bit MFC blind there. Have you tried replacing the windows procedure with your own, sort of like a proxy to the original? I owe you one...

          home

          M 1 Reply Last reply
          0
          • N Niklas L

            Ah sorry, got a bit MFC blind there. Have you tried replacing the windows procedure with your own, sort of like a proxy to the original? I owe you one...

            home

            M Offline
            M Offline
            mla154
            wrote on last edited by
            #5

            No problem and I appreciate your effort. I'm not exactly sure what you mean by replacing the windows procedure.  Could you elaborate on that a bit?  Which windows procedure?

            Regards, Mike

            N 1 Reply Last reply
            0
            • M mla154

              No problem and I appreciate your effort. I'm not exactly sure what you mean by replacing the windows procedure.  Could you elaborate on that a bit?  Which windows procedure?

              Regards, Mike

              N Offline
              N Offline
              Niklas L
              wrote on last edited by
              #6

              The idea is that if you can find the HWND for the file dialog, you could replace its WinProc[^]. All messages are routed through this method. So basically, remove the old WinProc, add your own (all using SetWindowLongPtr[^]), and in your own just redirect all messages to the original, intercepting the F1 keystroke. This will get you something like the MFC PreTranslateMessage ability.

              home

              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