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. How can I Handle character 'a' and character 'A' in pretranslate Message

How can I Handle character 'a' and character 'A' in pretranslate Message

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
13 Posts 3 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.
  • P phanindra varma

    Thanks for the Reply... But i have some problem when using WM_CHAR and WM_KEYDOWN message maps. So,Can i Handle it in "PreTranslateMessage".. any suggestions.......

    N Offline
    N Offline
    Naveen
    wrote on last edited by
    #4

    yes.

    nave [OpenedFileFinder]

    1 Reply Last reply
    0
    • P phanindra varma

      Thanks for the Reply... But i have some problem when using WM_CHAR and WM_KEYDOWN message maps. So,Can i Handle it in "PreTranslateMessage".. any suggestions.......

      C Offline
      C Offline
      CPallini
      wrote on last edited by
      #5

      You may use GetKeyState(VK_SHIFT) [^] to distinguish between lower case and upper case keys in PreTranslateMessage. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      N 1 Reply Last reply
      0
      • C CPallini

        You may use GetKeyState(VK_SHIFT) [^] to distinguish between lower case and upper case keys in PreTranslateMessage. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        N Offline
        N Offline
        Naveen
        wrote on last edited by
        #6

        CPallini wrote:

        You may use GetKeyState(VK_SHIFT) [^] to distinguish between lower case and upper case

        And when caps Lock Key is on? :-D

        nave [OpenedFileFinder]

        C 1 Reply Last reply
        0
        • N Naveen

          CPallini wrote:

          You may use GetKeyState(VK_SHIFT) [^] to distinguish between lower case and upper case

          And when caps Lock Key is on? :-D

          nave [OpenedFileFinder]

          C Offline
          C Offline
          CPallini
          wrote on last edited by
          #7

          Make a try before arguing ;P (i.e. CAPS LOCK key down makes GetKeyState(VK_SHIFT) returning the same value it returns whenever SHIFT key is held down) :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          N 1 Reply Last reply
          0
          • C CPallini

            Make a try before arguing ;P (i.e. CAPS LOCK key down makes GetKeyState(VK_SHIFT) returning the same value it returns whenever SHIFT key is held down) :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            N Offline
            N Offline
            Naveen
            wrote on last edited by
            #8

            CPallini wrote:

            Make a try before arguing

            But I tried now. GetKeyState(VK_SHIFT) is not giving the same value when shift key is down and when CAPS LOCK key is on. Did you actually check like this..? if( GetKeyState(VK_SHIFT)&0x8000 )

            nave [OpenedFileFinder]

            C 1 Reply Last reply
            0
            • N Naveen

              CPallini wrote:

              Make a try before arguing

              But I tried now. GetKeyState(VK_SHIFT) is not giving the same value when shift key is down and when CAPS LOCK key is on. Did you actually check like this..? if( GetKeyState(VK_SHIFT)&0x8000 )

              nave [OpenedFileFinder]

              C Offline
              C Offline
              CPallini
              wrote on last edited by
              #9

              Well, actually it is not the same value, but bit 0 contains the meaningful info in both cases, hence GetKeyState(VK_SHIFT) & 0x0001 should do the trick. :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              N 1 Reply Last reply
              0
              • C CPallini

                Well, actually it is not the same value, but bit 0 contains the meaningful info in both cases, hence GetKeyState(VK_SHIFT) & 0x0001 should do the trick. :)

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                [My articles]

                N Offline
                N Offline
                Naveen
                wrote on last edited by
                #10

                CPallini wrote:

                hence GetKeyState(VK_SHIFT) & 0x0001 should do the trick.

                I dont think so. Cause the low bit indicates the key is toggled. Suppose the application is started and at that state if( GetKeyState(VK_SHIFT) & 0x0001) - > will return false. Then I press shift key and release it. After that if( GetKeyState(VK_SHIFT) & 0x0001) - > will return true. Then if i again press shift and release, if( GetKeyState(VK_SHIFT) & 0x0001) - > will return false. So basically, checking the 0 bit have no meaning in the case of shift key. 0th have use only in the case of toggle keys such as CAPS LOCK, NUM LOCK etc...

                nave [OpenedFileFinder]

                C 1 Reply Last reply
                0
                • N Naveen

                  CPallini wrote:

                  hence GetKeyState(VK_SHIFT) & 0x0001 should do the trick.

                  I dont think so. Cause the low bit indicates the key is toggled. Suppose the application is started and at that state if( GetKeyState(VK_SHIFT) & 0x0001) - > will return false. Then I press shift key and release it. After that if( GetKeyState(VK_SHIFT) & 0x0001) - > will return true. Then if i again press shift and release, if( GetKeyState(VK_SHIFT) & 0x0001) - > will return false. So basically, checking the 0 bit have no meaning in the case of shift key. 0th have use only in the case of toggle keys such as CAPS LOCK, NUM LOCK etc...

                  nave [OpenedFileFinder]

                  C Offline
                  C Offline
                  CPallini
                  wrote on last edited by
                  #11

                  Again, make a test. (I did). :)

                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                  This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                  [My articles]

                  P 1 Reply Last reply
                  0
                  • C CPallini

                    Again, make a test. (I did). :)

                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                    [My articles]

                    P Offline
                    P Offline
                    phanindra varma
                    wrote on last edited by
                    #12

                    Thanks... GetKeyState() works fine.... Regards varma

                    C 1 Reply Last reply
                    0
                    • P phanindra varma

                      Thanks... GetKeyState() works fine.... Regards varma

                      C Offline
                      C Offline
                      CPallini
                      wrote on last edited by
                      #13

                      phanindra varma wrote:

                      Thanks...

                      You're welcome.

                      phanindra varma wrote:

                      GetKeyState() works fine....

                      Sure. :)

                      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                      [My articles]

                      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