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

C / C++ / MFC

 
GeneralRe: C++ Program Parameter Problem Pin
Blake Miller28-Mar-05 5:17
Blake Miller28-Mar-05 5:17 
GeneralRe: C++ Program Parameter Problem Pin
bneacetp28-Mar-05 10:35
bneacetp28-Mar-05 10:35 
GeneralPE explorer Pin
V.G26-Mar-05 6:00
V.G26-Mar-05 6:00 
GeneralRe: PE explorer Pin
David Crow26-Mar-05 7:21
David Crow26-Mar-05 7:21 
QuestionHow to send right control to an application Pin
d00peter26-Mar-05 5:58
d00peter26-Mar-05 5:58 
AnswerRe: How to send right control to an application Pin
Blake Miller28-Mar-05 5:31
Blake Miller28-Mar-05 5:31 
GeneralRe: How to send right control to an application Pin
d00peter28-Mar-05 21:19
d00peter28-Mar-05 21:19 
GeneralRe: How to send right control to an application Pin
Blake Miller29-Mar-05 5:05
Blake Miller29-Mar-05 5:05 
This is what I got to work:

// new way to call for VK_RCONTROL<br />
sendChar(VK_RCONTROL, 0x1D, TRUE);<br />
<br />
// new function<br />
void sendChar(BYTE c, WORD wScanCode, BOOL bExtended)<br />
{<br />
<br />
INPUT input[2] = {0};<br />
<br />
input[0].type = INPUT_KEYBOARD;<br />
input[0].ki.wVk = c;<br />
input[0].ki.wScan = wScanCode;<br />
if( bExtended ){<br />
 input[0].ki.dwFlags = KEYEVENTF_EXTENDEDKEY;<br />
}<br />
	<br />
input[1].type = INPUT_KEYBOARD;<br />
input[1].ki.wVk = c;<br />
input[1].ki.wScan = wScanCode;<br />
input[1].ki.dwFlags = KEYEVENTF_KEYUP;<br />
if( bExtended ){<br />
 input[1].ki.dwFlags |= KEYEVENTF_EXTENDEDKEY;<br />
}<br />
<br />
// the return values is 2 when this injects input correctly<br />
UINT uCount = ::SendInput(sizeof(input) / sizeof(INPUT), input, sizeof(INPUT));<br />
<br />
}


Whether or not the scan code was sent, and with the virtual key always set to VK_RCONTROL, the 'virtual key' my test progrma always received in the WM_KEYDOWN and WM_KEYUP was always VK_CONTROL.

I tried leaving out the scan code (or setting it to zero) and without the 'proper' scan code, the key events the progrma receives look like a regular CONTROL key with the 'extended key' flag bit set. I am not sure that your program processing the input would interpret that as the 'right' control key, but you can test it. You might need to add the scan code, but be aware that the scan codes can vary by keyboard. As a result, you might need to provide a 'configuration utility' to allow user to enter the scan codes for the special 'extended' keys you want to send.
GeneralRe: How to send right control to an application Pin
d00peter30-Mar-05 0:55
d00peter30-Mar-05 0:55 
GeneralMFC CWnd::UpdateData() question Pin
toxcct26-Mar-05 4:14
toxcct26-Mar-05 4:14 
GeneralRe: MFC CWnd::UpdateData() question Pin
David Crow26-Mar-05 7:23
David Crow26-Mar-05 7:23 
GeneralRe: MFC CWnd::UpdateData() question Pin
Michael Dunn26-Mar-05 9:44
sitebuilderMichael Dunn26-Mar-05 9:44 
GeneralRe: MFC CWnd::UpdateData() question Pin
toxcct28-Mar-05 7:56
toxcct28-Mar-05 7:56 
GeneralCopy class (derived from CObject) Pin
AnTri26-Mar-05 2:19
AnTri26-Mar-05 2:19 
GeneralRe: Copy class (derived from CObject) Pin
toxcct26-Mar-05 4:11
toxcct26-Mar-05 4:11 
GeneralVisual C++ Pointers Pin
Usman Arif26-Mar-05 2:18
Usman Arif26-Mar-05 2:18 
GeneralRe: Visual C++ Pointers Pin
Maximilien26-Mar-05 3:38
Maximilien26-Mar-05 3:38 
GeneralRe: Visual C++ Pointers Pin
MMansonFan2529-Mar-05 23:10
MMansonFan2529-Mar-05 23:10 
GeneralProblem with ActiveX control's initial size(Please read this , i need this for my final year project) Pin
Faisal Sajjad26-Mar-05 1:13
Faisal Sajjad26-Mar-05 1:13 
GeneralLogic Question Pin
RedDragon2k26-Mar-05 1:12
RedDragon2k26-Mar-05 1:12 
GeneralRe: Logic Question Pin
toxcct26-Mar-05 4:13
toxcct26-Mar-05 4:13 
GeneralRe: Logic Question Pin
RedDragon2k26-Mar-05 5:54
RedDragon2k26-Mar-05 5:54 
GeneralRe: Logic Question Pin
Roger Wright26-Mar-05 6:43
professionalRoger Wright26-Mar-05 6:43 
GeneralRe: Logic Question Pin
RedDragon2k26-Mar-05 8:59
RedDragon2k26-Mar-05 8:59 
GeneralRe: Logic Question Pin
Roger Wright26-Mar-05 20:46
professionalRoger Wright26-Mar-05 20:46 

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.