Click here to Skip to main content
15,913,709 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: problem with Oleacc Pin
John R. Shaw22-Dec-04 16:18
John R. Shaw22-Dec-04 16:18 
GeneralRe: problem with Oleacc Pin
spsharma22-Dec-04 16:33
spsharma22-Dec-04 16:33 
Questioncan i got the item index from the item lparam? Pin
lowiq22-Dec-04 13:39
lowiq22-Dec-04 13:39 
AnswerRe: can i got the item index from the item lparam? Pin
Michael Dunn22-Dec-04 17:30
sitebuilderMichael Dunn22-Dec-04 17:30 
GeneralRe: can i got the item index from the item lparam? Pin
lowiq22-Dec-04 20:58
lowiq22-Dec-04 20:58 
AnswerRe: can i got the item index from the item lparam? Pin
David Crow23-Dec-04 3:52
David Crow23-Dec-04 3:52 
Generalsend key to window Pin
Spiritofamerica22-Dec-04 11:49
Spiritofamerica22-Dec-04 11:49 
GeneralRe: send key to window Pin
Antti Keskinen22-Dec-04 12:29
Antti Keskinen22-Dec-04 12:29 
The WM_KEYDOWN message is sent to a window when the window has focus and a non-system keyboard key goes down and remains pressed. After the keyboard repeat delay, multiple WM_KEYDOWN messages are simultaneously generated. A non-system keyboard key is any key excluding F10 and keys pressed together with ALT. To simulate an ALT + key combination, use WM_SYSKEYDOWN message.

In order to simulate a keypress to a window, use WM_CHAR message. WM_CHAR messages are not translated anymore, so the keycode you issue for it will proceed directly as-is to the receiving window. WM_KEYDOWN messages have virtual key-codes that are translated to character codes. WM_CHAR messages have character-code (ASCII) values with them.

To precisely simulate a keypress (such as CTRL/SHIFT + key), you must generate virtual keypress events. This is much more complicated than just sending a single message. Check SendInput in MSDN. In here, you will generate sequentical keyboard events for each and every event of the key combination. Remember that pressing CTRL + SHIFT + F, for example, consists of first setting CTRL, SHIFT and F keys to pressed state, in order, and then releasing them, in inverse order. Note that to target the keypress combination, you must set the target window active by using SetFocus.

Also, if your program is running on a seperate thread than the target program, you must first attach the input streams by using AttachThreadInput, and detach them after you've synthesized the keystrokes.

-Antti Keskinen

----------------------------------------------
"If we wrote a report stating we saw a jet fighter with a howitzer, who's going to believe us ?"

-- R.A.F. pilot quote on seeing a Me 262 armed with a 50mm Mauser cannon.
GeneralConverting 2s complement to signed int Pin
Wheatbread22-Dec-04 10:39
Wheatbread22-Dec-04 10:39 
GeneralRe: Converting 2s complement to signed int Pin
Tim Smith22-Dec-04 11:09
Tim Smith22-Dec-04 11:09 
GeneralAnyone know of a pluggin... Pin
Ian Bowler22-Dec-04 9:47
Ian Bowler22-Dec-04 9:47 
GeneralRe: Anyone know of a pluggin... Pin
RChin22-Dec-04 23:18
RChin22-Dec-04 23:18 
GeneralTesting Client socket is alive Pin
kalicharan22-Dec-04 8:39
kalicharan22-Dec-04 8:39 
GeneralRe: Testing Client socket is alive Pin
Henry miller22-Dec-04 9:58
Henry miller22-Dec-04 9:58 
Generalfixup error Pin
nainakhawaja22-Dec-04 8:37
nainakhawaja22-Dec-04 8:37 
GeneralRe: fixup error Pin
David Crow22-Dec-04 9:10
David Crow22-Dec-04 9:10 
GeneralDragging rectangle Pin
Anonymous22-Dec-04 8:19
Anonymous22-Dec-04 8:19 
GeneralRe: Dragging rectangle Pin
David Crow22-Dec-04 9:03
David Crow22-Dec-04 9:03 
GeneralRe: Dragging rectangle Pin
Anonymous22-Dec-04 11:45
Anonymous22-Dec-04 11:45 
GeneralRe: Dragging rectangle Pin
John R. Shaw22-Dec-04 16:05
John R. Shaw22-Dec-04 16:05 
GeneralVC6 function template problems Pin
peterchen22-Dec-04 7:47
peterchen22-Dec-04 7:47 
GeneralRe: VC6 function template problems Pin
Antti Keskinen22-Dec-04 13:04
Antti Keskinen22-Dec-04 13:04 
GeneralRe: VC6 function template problems Pin
peterchen22-Dec-04 19:53
peterchen22-Dec-04 19:53 
GeneralSetWindowText gives me headache Pin
toxcct22-Dec-04 7:02
toxcct22-Dec-04 7:02 
GeneralRe: SetWindowText gives me headache Pin
David Crow22-Dec-04 8:18
David Crow22-Dec-04 8:18 

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.