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. PostMesssage Virtual key code

PostMesssage Virtual key code

Scheduled Pinned Locked Moved C / C++ / MFC
data-structurestutorialquestion
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.
  • K Offline
    K Offline
    kasturirawat
    wrote on last edited by
    #1

    I’m trying to send data to console window using PostMessage with WM_KEYDOWN. The third and fourth param for postmessage are WPARAM wParam, // virtual-key code LPARAM lParam // key data i.e. PostMessage( hwndDOS, WM_KEYDOWN, ‘K’, 0X10250001 ); Any idea how to translate my array (ascii data such as abcd, <> fg etc ) to third and fourth parameter? Thanks

    R T 2 Replies Last reply
    0
    • K kasturirawat

      I’m trying to send data to console window using PostMessage with WM_KEYDOWN. The third and fourth param for postmessage are WPARAM wParam, // virtual-key code LPARAM lParam // key data i.e. PostMessage( hwndDOS, WM_KEYDOWN, ‘K’, 0X10250001 ); Any idea how to translate my array (ascii data such as abcd, <> fg etc ) to third and fourth parameter? Thanks

      R Offline
      R Offline
      Rickard Andersson20
      wrote on last edited by
      #2

      Try this, haven't try it myselft but try you:

      ::SendMessage(hWnd,WM_KEYDOWN, VK_K, 0);

      You have to vrite the virtual key (VK_K) not only K, the compiler doesn't recognize K. I'm not sure it will work in console window! A CONSOLE IS NOT A DOS APP!! REMEMBER THAT BUDDY!! ------------------------------ ©0d3 ©®4©k3® - That's me! :) ------------------------------

      N 1 Reply Last reply
      0
      • R Rickard Andersson20

        Try this, haven't try it myselft but try you:

        ::SendMessage(hWnd,WM_KEYDOWN, VK_K, 0);

        You have to vrite the virtual key (VK_K) not only K, the compiler doesn't recognize K. I'm not sure it will work in console window! A CONSOLE IS NOT A DOS APP!! REMEMBER THAT BUDDY!! ------------------------------ ©0d3 ©®4©k3® - That's me! :) ------------------------------

        N Offline
        N Offline
        Nish Nishant
        wrote on last edited by
        #3

        I am not sure whether WM_KEYDOWN will work for a console app. You might have to do something else like redirecting STDIN or whatever. Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

        R 1 Reply Last reply
        0
        • N Nish Nishant

          I am not sure whether WM_KEYDOWN will work for a console app. You might have to do something else like redirecting STDIN or whatever. Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

          R Offline
          R Offline
          Rickard Andersson20
          wrote on last edited by
          #4

          As I said in the message! :) I've never do console apps because it's useless time for me doing console apps! ;) ------------------------------ ©0d3 ©®4©k3® - That's me! :) ------------------------------

          K 1 Reply Last reply
          0
          • R Rickard Andersson20

            As I said in the message! :) I've never do console apps because it's useless time for me doing console apps! ;) ------------------------------ ©0d3 ©®4©k3® - That's me! :) ------------------------------

            K Offline
            K Offline
            kasturirawat
            wrote on last edited by
            #5

            It works with DOS window for AlphaNumerics. But any idea how to translate $ and & to VK_Key?

            1 Reply Last reply
            0
            • K kasturirawat

              I’m trying to send data to console window using PostMessage with WM_KEYDOWN. The third and fourth param for postmessage are WPARAM wParam, // virtual-key code LPARAM lParam // key data i.e. PostMessage( hwndDOS, WM_KEYDOWN, ‘K’, 0X10250001 ); Any idea how to translate my array (ascii data such as abcd, <> fg etc ) to third and fourth parameter? Thanks

              T Offline
              T Offline
              Tim Deveaux
              wrote on last edited by
              #6

              this thread ...and, yes, it will work for a console window. (Mind, the code needs a bit of cleanup :))

              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