Click here to Skip to main content
15,888,454 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Size of Dialog at run time Pin
Cedric Moonen4-Aug-09 0:59
Cedric Moonen4-Aug-09 0:59 
QuestionIWMPPlayer in WMP plugin Pin
da-kak-tak3-Aug-09 23:25
da-kak-tak3-Aug-09 23:25 
QuestionSending keystrokes to other *non-focus* application Pin
audi023-Aug-09 23:00
audi023-Aug-09 23:00 
AnswerRe: Sending keystrokes to other *non-focus* application Pin
Adam Roderick J3-Aug-09 23:45
Adam Roderick J3-Aug-09 23:45 
QuestionRe: Sending keystrokes to other *non-focus* application Pin
David Crow4-Aug-09 2:57
David Crow4-Aug-09 2:57 
AnswerRe: Sending keystrokes to other *non-focus* application Pin
audi025-Aug-09 12:06
audi025-Aug-09 12:06 
AnswerRe: Sending keystrokes to other *non-focus* application Pin
amatecki4-Aug-09 3:04
professionalamatecki4-Aug-09 3:04 
AnswerRe: Sending keystrokes to other *non-focus* application Pin
Randor 4-Aug-09 3:23
professional Randor 4-Aug-09 3:23 
audi02 wrote:
But still problem - it doesn't put the letter on the notepad... why?


This is by Microsoft design. SendInput[^] and keybd_event[^] inserts keyboard input directly into the kernel input stream. The Windows subsystem Win32k.sys handles user input for usermode windows. Windows that do not have focus do not recieve the WM_KEYDOWN Notification[^], WM_CHAR Notification[^] nor the WM_KEYUP Notification[^].

If you want to send simulated keystrokes to windows that do not have focus you will need to either:

1.) Use the BringWindowToTop Function to bring the window to top before simulating keystrokes.
2.) Use the PostMessage Function[^] to do the dirty work of Win32k.sys

This should do the trick:
PostMessage(hTargetWnd,WM_CHAR,'g',0);


Note that using PostMessage to simulate keyboard input is not recommended for a variety of reasons. Some of which include... hooks will not be called... GetKeyState and GetAsyncKeyState will not return correct results... GetQueueStatus with QS_INPUT will not be correct. In a nutshell... by using PostMessage you will be bypassing alot of the Win32k subsystems which could result in undesired behavior.

Best Wishes,
-David Delaune
GeneralRe: Sending keystrokes to other *non-focus* application Pin
audi025-Aug-09 12:12
audi025-Aug-09 12:12 
GeneralRe: Sending keystrokes to other *non-focus* application Pin
Randor 5-Aug-09 15:30
professional Randor 5-Aug-09 15:30 
QuestionTime Priority In LCC win32 Pin
kyai433-Aug-09 21:07
kyai433-Aug-09 21:07 
AnswerRe: Time Priority In LCC win32 [modified] Pin
Adam Roderick J3-Aug-09 22:03
Adam Roderick J3-Aug-09 22:03 
QuestionCome in please, which VC do you like? Pin
includeh103-Aug-09 20:58
includeh103-Aug-09 20:58 
AnswerRe: Come in please, which VC do you like? Pin
Michael Dunn3-Aug-09 21:54
sitebuilderMichael Dunn3-Aug-09 21:54 
GeneralRe: Come in please, which VC do you like? Pin
includeh103-Aug-09 22:01
includeh103-Aug-09 22:01 
AnswerRe: Come in please, which VC do you like? Pin
Adam Roderick J3-Aug-09 22:08
Adam Roderick J3-Aug-09 22:08 
GeneralRe: Come in please, which VC do you like? Pin
Chandrasekharan P3-Aug-09 22:18
Chandrasekharan P3-Aug-09 22:18 
AnswerRe: Come in please, which VC do you like? Pin
«_Superman_»3-Aug-09 22:09
professional«_Superman_»3-Aug-09 22:09 
GeneralRe: Come in please, which VC do you like? Pin
Naveen3-Aug-09 22:18
Naveen3-Aug-09 22:18 
AnswerRe: Come in please, which VC do you like? Pin
Rajesh R Subramanian3-Aug-09 23:01
professionalRajesh R Subramanian3-Aug-09 23:01 
AnswerRe: Come in please, which VC do you like? Pin
songBX3-Aug-09 23:29
songBX3-Aug-09 23:29 
GeneralRe: Come in please, which VC do you like? Pin
Kushagra Tiwari4-Aug-09 3:08
Kushagra Tiwari4-Aug-09 3:08 
AnswerRe: Come in please, which VC do you like? Pin
Joe Woodbury4-Aug-09 16:24
professionalJoe Woodbury4-Aug-09 16:24 
AnswerRe: Come in please, which VC do you like? Pin
Moak8-Aug-09 8:39
Moak8-Aug-09 8:39 
QuestionIs self-defined OS version safe? Pin
includeh103-Aug-09 20:39
includeh103-Aug-09 20:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.