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. Post Message for Key

Post Message for Key

Scheduled Pinned Locked Moved C / C++ / MFC
help
4 Posts 4 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.
  • B Offline
    B Offline
    bhanu_8509
    wrote on last edited by
    #1

    Hello all, Please tell me is it possible to send the WM_KEYDOWN message to the program without pressing any key in the keyboard. I want to call a method which has been written in the keydown event without pressing any key for the first time only. Please help me. Many thanks in advance.

    C I R 3 Replies Last reply
    0
    • B bhanu_8509

      Hello all, Please tell me is it possible to send the WM_KEYDOWN message to the program without pressing any key in the keyboard. I want to call a method which has been written in the keydown event without pressing any key for the first time only. Please help me. Many thanks in advance.

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      Yes you can send a WM_KEYDOWN message but it doesn't make a lot of sense. Why don't you instead move that specific code into a separate function that you call from within your key down handler and that you can call directly instead of sending the WM_KEYDOWN message.

      Cédric Moonen Software developer
      Charting control [v1.4] OpenGL game tutorial in C++

      1 Reply Last reply
      0
      • B bhanu_8509

        Hello all, Please tell me is it possible to send the WM_KEYDOWN message to the program without pressing any key in the keyboard. I want to call a method which has been written in the keydown event without pressing any key for the first time only. Please help me. Many thanks in advance.

        I Offline
        I Offline
        Iain Clarke Warrior Programmer
        wrote on last edited by
        #3

        You can use the well named (for a change) SendInput funcion. Or rearrange your question to give an answer of "SendMesssage (WM_KEYDOWN,...". But as Cedric said, this is a TERRIBLE idea if you have any sort of access to the software involved. Otherwise there are lots of errors for you to make. If you don't send a matching WM_KEYUP for example, there could be all sorts of "fun" ! Iain.

        1 Reply Last reply
        0
        • B bhanu_8509

          Hello all, Please tell me is it possible to send the WM_KEYDOWN message to the program without pressing any key in the keyboard. I want to call a method which has been written in the keydown event without pressing any key for the first time only. Please help me. Many thanks in advance.

          R Offline
          R Offline
          Rajesh R Subramanian
          wrote on last edited by
          #4

          See if this helps: Keyboard events simulation using keybd_event() function[^] SendKeys in C++[^] OnScreen Keyboard[^]

          Please leave us our small pleasures, they are small, but they are ours! - Mycroft Holmes ^ .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

          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