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. PreTranslateMessage

PreTranslateMessage

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
3 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.
  • V Offline
    V Offline
    Vancouver
    wrote on last edited by
    #1

    From the MSDN Library: Return Value Nonzero if the message was translated and should not be dispatched; 0 if the message was not translated and should be dispatched I have a PreTranslateMessage function (with MFC) to catch some special keys (actually WM_SYSKEYUP). When my "special" keystroke arrives, I process it, and I don't want it to be further processed. However, no matter what return code I give back, the message will be processed, i.e. the character arrives as if it had not been processed yet. Modifying the MSG structure (the parameter of the function) yields nothing. What can I do? Should I use another function instead of PreTranslateMessage? Which one? Thanks

    T 1 Reply Last reply
    0
    • V Vancouver

      From the MSDN Library: Return Value Nonzero if the message was translated and should not be dispatched; 0 if the message was not translated and should be dispatched I have a PreTranslateMessage function (with MFC) to catch some special keys (actually WM_SYSKEYUP). When my "special" keystroke arrives, I process it, and I don't want it to be further processed. However, no matter what return code I give back, the message will be processed, i.e. the character arrives as if it had not been processed yet. Modifying the MSG structure (the parameter of the function) yields nothing. What can I do? Should I use another function instead of PreTranslateMessage? Which one? Thanks

      T Offline
      T Offline
      twing
      wrote on last edited by
      #2

      try it in PreTranslateMessage() if (pMsg->message == WM_SYSKEYUP) { //do your things; //return your bool; } else return CDialog::PreTranslateMessage(pMsg); Hello World!

      V 1 Reply Last reply
      0
      • T twing

        try it in PreTranslateMessage() if (pMsg->message == WM_SYSKEYUP) { //do your things; //return your bool; } else return CDialog::PreTranslateMessage(pMsg); Hello World!

        V Offline
        V Offline
        Vancouver
        wrote on last edited by
        #3

        I tried around, and just found the solution (quite trivial): BOTH WM_SYSKEYUP and WM_SYSKEYDOWN have to be processed. One of them has to do the "real" processing, the other nothing, but both have to return nonzero. Thanks anyway.

        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