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. virtual BOOL PreTranslateMessage(MSG* pMsg);

virtual BOOL PreTranslateMessage(MSG* pMsg);

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 3 Posters 1 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.
  • T Offline
    T Offline
    TalSt
    wrote on last edited by
    #1

    Hello, I would like to stop all messages to the window taskbar. I try to use the PreTranslateMessage function and it seems that the messages to the taskbar are not sending throw this function. Do you know a way to catch the messages? Do you know if it should be throw this function? Thank a lot ;) !

    N S 2 Replies Last reply
    0
    • T TalSt

      Hello, I would like to stop all messages to the window taskbar. I try to use the PreTranslateMessage function and it seems that the messages to the taskbar are not sending throw this function. Do you know a way to catch the messages? Do you know if it should be throw this function? Thank a lot ;) !

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #2

      TalSt wrote:

      I would like to stop all messages to the window taskbar. I try to use the PreTranslateMessage function and it seems that the messages to the taskbar are not sending throw this function. Do you know a way to catch the messages?

      Use GetWindowLong and GWL_WNDPROC to get a window's main procedure address and replace it with your own version using SetWindowLong. Now messages to the window which you hooked should go via your WindowProc. Store replaced WindowProc ptr to use with CallWindowProc to do default stuff. Don't forget to replace back this ptr when your application exits!

      Nibu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com

      T 1 Reply Last reply
      0
      • N Nibu babu thomas

        TalSt wrote:

        I would like to stop all messages to the window taskbar. I try to use the PreTranslateMessage function and it seems that the messages to the taskbar are not sending throw this function. Do you know a way to catch the messages?

        Use GetWindowLong and GWL_WNDPROC to get a window's main procedure address and replace it with your own version using SetWindowLong. Now messages to the window which you hooked should go via your WindowProc. Store replaced WindowProc ptr to use with CallWindowProc to do default stuff. Don't forget to replace back this ptr when your application exits!

        Nibu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com

        T Offline
        T Offline
        TalSt
        wrote on last edited by
        #3

        Hello, Can you give more details? I am not sure I understand... How can the messages be stopped this way? Thanks :doh: !

        N 1 Reply Last reply
        0
        • T TalSt

          Hello, Can you give more details? I am not sure I understand... How can the messages be stopped this way? Thanks :doh: !

          N Offline
          N Offline
          Nibu babu thomas
          wrote on last edited by
          #4

          TalSt wrote:

          Can you give more details? I am not sure I understand... How can the messages be stopped this way?

          An easier option if you are using MFC is CWnd::SubclassWindow. Something more on XXXWindowLong is here -> http://www.google.co.in/search?q=GetWindowLong+GWL_WNDPROc&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a[^] As you should be knowing that WindowProc is the main procedure through which a window receives messages, so hooking this procedure with your function will help you to filter messages.

          Nibu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com

          1 Reply Last reply
          0
          • T TalSt

            Hello, I would like to stop all messages to the window taskbar. I try to use the PreTranslateMessage function and it seems that the messages to the taskbar are not sending throw this function. Do you know a way to catch the messages? Do you know if it should be throw this function? Thank a lot ;) !

            S Offline
            S Offline
            Stephen Hewitt
            wrote on last edited by
            #5

            I assume by "window taskbar" you mean the taskbar with the "Start" button on it. This is part of "Explorer.exe". You can't expect to recieve messages from windows in another process via "PreTranslateMessage"!

            Steve

            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