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