It IS Microsoft. Say no more.
(If a Microsoft lawyer is reading this post, sit on this .|..).
Printable View
It IS Microsoft. Say no more.
(If a Microsoft lawyer is reading this post, sit on this .|..).
OK, I give up
How do you get to be a Linux, Unix or a Mac programmer?
Sally
Oh,My God! How a discussion! Why don't you try my way:
HWND hWnd=::FindWindow(NULL, some window caption);
if (hWnd)
{
BYTE ks[1]=
{
VK_CTRL//if wanna to send a ALT+somekey, change to VK_MENU
};
DWORD tid=::GetWindowThreadProcessId(hWnd,NULL);
::SetKeyboardState(ks);
::AttachThreadInput(::GetCurrentThreadId(),tid,TRUE);
::BringWindowToTop(hWnd);
::PostMessage(hWnd,WM_KEYDOWN,someletter, 0);
::AttachThreadInput(::GetCurrentThreadId(),tid,FALSE);
}
However, I can't send the "shift+somekey", nor the combination of 3 keys, sush as "CTRL+SHIFT+somekey".
Hey, I am a faithful linux fan.I am now studying
the network and XWindow programming. Is there anybody interested in these?
Thats all exciting ... but I tried to use your code to send WM_SYSKEYDOWN / -UP messages from a child to its parent (that is from a tab page to its containing dialog). I sent the message from out PreTranslateMessage() when receiving a WM_SYSKEYxxx for a system key that doesn't exist on this page. It doesn't do anything at all, even the WM_KEYDOWN message does not reach the parent. What am I doing wrong?
PreTranslateMessage( ... )
{
...
else if( ((pMsg->message == WM_SYSKEYDOWN) || (pMsg->message == WM_SYSKEYUP)) && (pMsg->wParam != VK_MENU) )
{
if( !IsSysKey(pMsg->wParam) ) // SysKey dieser Page ?
if( ((CPraxisDialog*)GetOwner()->GetOwner())->IsSysKey(pMsg->wParam) )
{
BYTE ks[1] = { VK_MENU };
GetOwner()->GetOwner()->SetFocus();
::SetKeyboardState( ks );
::AttachThreadInput( ::GetCurrentThreadId(), ::GetWindowThreadProcessId(GetOwner()->GetOwner()->m_hWnd, NULL), TRUE );
::BringWindowToTop( GetOwner()->GetOwner()->m_hWnd );
GetOwner()->GetOwner()->PostMessage( (pMsg->message == WM_SYSKEYDOWN)? WM_KEYDOWN : WM_KEYUP, pMsg->wParam, 0 );//pMsg->lParam );
::AttachThreadInput( ::GetCurrentThreadId(),
::GetWindowThreadProcessId(GetOwner()->GetOwner()->m_hWnd, NULL), FALSE );
return TRUE;
}
}
Hi All:
I hope this can help
Try this: (first of all you need the HWND of the window wich will receive the message, in this case ventana)
HWND ventana;
.....
::BringWindowToTop(ventana); //bring ventana to TOP
// simulate Alt + return
keybd_event(VK_MENU,
0,
0,
0);
keybd_event(VK_RETURN,
0,
0,
0);
keybd_event(VK_RETURN,
0,
KEYEVENTF_KEYUP,
0);
keybd_event(VK_MENU,
0,
KEYEVENTF_KEYUP,
0);
Can you pls tell how did you get this 24 equelent fo Ctrl + X ?Quote:
Originally Posted by shellreef
Since Shellreef hasn't posted for over 9 years, I wouldn't waste a lot of time waiting for a response. :ehh:
oh, is this thread 9 years old, oh then they are now too old to post a reply :)