michal_
February 1st, 2005, 06:40 AM
Hi All
i need to send various combination of keys like SHIFT+a, ALT+a, CTRL+c etc to edit control, but problem is that this edit control is inactive, hasnt got focus and mustn't receive focus so function keybd_event or sendinput i can't use, i try using following code for example for shift:
PostMessage(hEdit,WM_KEYDOWN,VK_SHIFT,MapVirtualKey(VK_SHIFT,0) | 0x00000001);
PostMessage(hEdit,WM_CHAR,'a',1);
PostMessage(hEdit,WM_KEYUP,VK_SHIFT,MapVirtualKey(VK_SHIFT,0) | 0xC0000001);
but i still have small a, but in this case i should get big one
i try also something like this
char a[256];
GetKeyboardState(a);
a[VK_SHIFT] |= 0x80;
SetKeyboardState(a);
SendMessage(hEdit,WM_CHAR,'a',1);
a[VK_SHIFT] &= 0x7F;
SetKeyboardState(a);
but it still doesn't work, i need solution which works like sendinput or keybd_event but can send keys to control which dont have focus and cant received it, any suggestion??? i will be gratefull
Greats
Michal
i need to send various combination of keys like SHIFT+a, ALT+a, CTRL+c etc to edit control, but problem is that this edit control is inactive, hasnt got focus and mustn't receive focus so function keybd_event or sendinput i can't use, i try using following code for example for shift:
PostMessage(hEdit,WM_KEYDOWN,VK_SHIFT,MapVirtualKey(VK_SHIFT,0) | 0x00000001);
PostMessage(hEdit,WM_CHAR,'a',1);
PostMessage(hEdit,WM_KEYUP,VK_SHIFT,MapVirtualKey(VK_SHIFT,0) | 0xC0000001);
but i still have small a, but in this case i should get big one
i try also something like this
char a[256];
GetKeyboardState(a);
a[VK_SHIFT] |= 0x80;
SetKeyboardState(a);
SendMessage(hEdit,WM_CHAR,'a',1);
a[VK_SHIFT] &= 0x7F;
SetKeyboardState(a);
but it still doesn't work, i need solution which works like sendinput or keybd_event but can send keys to control which dont have focus and cant received it, any suggestion??? i will be gratefull
Greats
Michal