Vano
October 20th, 1999, 01:15 PM
Hi !
I have the following problem: I want to send a keyboard message from my application to another one(rather window which Hwnd is known). In case of one key pressing I'm using this code
DWORD wParam = (int) 'A';
DWORD lParam = 1; // repeat count
lParam = (0x1E) << 16 - // 'a' scan code
::PostMessage(hWnd,WM_KEYDOWN,wParam,lParam)
lParam |= 1<<30;
lParam |= 1<<31; // for WM_KEYUP
::PostMessage(hWnd,WM_KEYUP,wParam,lParam);
But in case of multiple keystrokes, e.g. Ctrl+A this is not working.
DWORD wCtrl = VK_CONTROL;
DWORD lCtrl = 1; //repeat count
lCtrl |= 0x1D << 16; - //Control scan code
::PostMessage(hWnd,WM_KEYDOWN,wCtrl,lCtrl);
::PostMessage(hWnd,WM_KEYDOWN,wParam,lParam);
lParam |= 1<<30;
lParam |= 1<<31; // for WM_KEYUP
lCtrl |= 1<<30;
lCtrl |= 1<<31; // for WM_KEYUP
::PostMessage(hWnd,WM_KEYUP,wCtrl,lCtrl);
::PostMessage(hWnd,WM_KEYUP,wParam,lParam);
Insted of Ctrl+A Ctrl,a is happaning :((
Application process the last sent WM_KEYDOWN message after the last WM_KEYUP message and sends WM_CHAR message itself.
Where is the error or what is wrong ?
WBR, Ivan.
I have the following problem: I want to send a keyboard message from my application to another one(rather window which Hwnd is known). In case of one key pressing I'm using this code
DWORD wParam = (int) 'A';
DWORD lParam = 1; // repeat count
lParam = (0x1E) << 16 - // 'a' scan code
::PostMessage(hWnd,WM_KEYDOWN,wParam,lParam)
lParam |= 1<<30;
lParam |= 1<<31; // for WM_KEYUP
::PostMessage(hWnd,WM_KEYUP,wParam,lParam);
But in case of multiple keystrokes, e.g. Ctrl+A this is not working.
DWORD wCtrl = VK_CONTROL;
DWORD lCtrl = 1; //repeat count
lCtrl |= 0x1D << 16; - //Control scan code
::PostMessage(hWnd,WM_KEYDOWN,wCtrl,lCtrl);
::PostMessage(hWnd,WM_KEYDOWN,wParam,lParam);
lParam |= 1<<30;
lParam |= 1<<31; // for WM_KEYUP
lCtrl |= 1<<30;
lCtrl |= 1<<31; // for WM_KEYUP
::PostMessage(hWnd,WM_KEYUP,wCtrl,lCtrl);
::PostMessage(hWnd,WM_KEYUP,wParam,lParam);
Insted of Ctrl+A Ctrl,a is happaning :((
Application process the last sent WM_KEYDOWN message after the last WM_KEYUP message and sends WM_CHAR message itself.
Where is the error or what is wrong ?
WBR, Ivan.