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 to simulate entering text in a CEdit

How to simulate entering text in a CEdit

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
2 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.
  • C Offline
    C Offline
    coldFire_ro
    wrote on last edited by
    #1

    I want to simultate that the user typed some text in a single line CEdit control (in another application) and then pressed the Enter key. The problem is I want it done without the control having keyboard focus. I found the control's handle, I tried sending the WM_SETTEXT message with the text and it works, regardless of the keyboard focus, But when I tried sending the WM_KEYDOWN or WM_CHAR message with the VK_ENTER key it only works if the control has keyboard focus. Does anyone know how to solve this problem? Thx

    C 1 Reply Last reply
    0
    • C coldFire_ro

      I want to simultate that the user typed some text in a single line CEdit control (in another application) and then pressed the Enter key. The problem is I want it done without the control having keyboard focus. I found the control's handle, I tried sending the WM_SETTEXT message with the text and it works, regardless of the keyboard focus, But when I tried sending the WM_KEYDOWN or WM_CHAR message with the VK_ENTER key it only works if the control has keyboard focus. Does anyone know how to solve this problem? Thx

      C Offline
      C Offline
      cje
      wrote on last edited by
      #2

      I may be totally misunderstanding your question but if the WM_SETTEXT gives you the desired functionality, to make it look like some one is typing could you not just call WM_SETTEXT multiple times...for example to 'type' Hello could you not do WM_SETTEXT 'H' WM_SETTEXT 'He' WM_SETTEXT 'Hel' WM_SETTEXT 'Hell' WM_SETTEXT 'Hello'

      cje

      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