Roel Schroeven <[EMAIL PROTECTED]> writes: > Tim Roberts wrote: > >> On Wed, 30 Mar 2005 20:46:43 -0500, Daniel F <[EMAIL PROTECTED]> wrote: >> >>> Well... i figured it out - turns out sending the keystrokes to the top >>> window of notepad didnt work, but sending them to the Edit child >>> window of notepad did the trick. >>> >>> But this brings me to another question, although of a less urgent >>> manner. i had to send WM_CHAR messages, rather than WM_KEYDOWN/KEYUP >>> in order to get it to work. I have nothing against WM_CHAR, as long as >>> everything works, but i am just curious why i was not able to achieve >>> the same effect with the WM_KEYDOWN/KEYUP pair? any takers? >>> >> It depends entirely on what the application expects. When the keyboard >> driver sends keystrokes, the generic keyboard driver translates the key >> codes to characters, if possible. It will send WM_KEYDOWN, then WM_CHAR >> (if an ASCII translation exists), then WM_KEYUP. Applications can >> choose which ones they want to handle. > > Not really: AFAIK this is not done by the keyboard driver; it is done by > the TranslateMessage function which is normally called in the message loop. > > MSDN on WM_CHAR: "The WM_CHAR message is posted to the window with the > keyboard focus when a WM_KEYDOWN message is translated by the > TranslateMessage function" >
Since TranslateMessage, which is typically called in the application's message pump, creates the WM_CHAR messages, the OP would probably get what he expects when he uses PostMessage for WM_KEYDOWN/WM_KEYUP instead of SendMessage. Thomas _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32