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 synchronize the input of two windows

how to synchronize the input of two windows

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

    i want to synchronize the keyboard input of two windows.that is , i have two windows(window1 and window2).window1 is the top window on the desktop,window2 is behind window1. there is a edit control on both windows. when i input char in the edit of window1.i want window2 change with window1.juse like i both input char in edit of window2. the function AttachThreadInput seems to resolve my problem, but it does not work as i expected. anyone can tell me other solutions. here i should tell that window1 and window2 are in deffrent processes.window2 is an existent third-party program. i can do nothing about it.all i can do is in window1. gucy

    F 1 Reply Last reply
    0
    • G gucy

      i want to synchronize the keyboard input of two windows.that is , i have two windows(window1 and window2).window1 is the top window on the desktop,window2 is behind window1. there is a edit control on both windows. when i input char in the edit of window1.i want window2 change with window1.juse like i both input char in edit of window2. the function AttachThreadInput seems to resolve my problem, but it does not work as i expected. anyone can tell me other solutions. here i should tell that window1 and window2 are in deffrent processes.window2 is an existent third-party program. i can do nothing about it.all i can do is in window1. gucy

      F Offline
      F Offline
      Fahr
      wrote on last edited by
      #2

      What about using some API calls to find the hWnd of the textbox in Window2. Take a look at: - FindWindow - GetDlgItem Use it somewhat as follows: HWND hMainWindow = FindWindow("[ClassName of main window]", NULL); if(hMainWindow != NULL) { HWND hTextbox = GetDlgItem(hMainWindow, [ID of the textbox]); ... } You can find out the classname of the main window and the ID of the textbox using Greatis Windowse (google on it, I don't have the link just like that). Once you figured out the hWnd of the textbox, you can use SetWindowText or a SendMessage WM_SETTEXT to put the text in the box in dialog 2. Another option might be SetDlgItemText, but then you can't check the hTextBox hWnd to be valid or not before sending. Good luck! - Fahr

      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