|
-
May 24th, 1999, 07:51 AM
#16
Re: Help! How to send a CTRL+X key to another window?
It IS Microsoft. Say no more.
(If a Microsoft lawyer is reading this post, sit on this .|..).
-
May 24th, 1999, 08:11 AM
#17
Re: Help! How to send a CTRL+X key to another window?
OK, I give up
How do you get to be a Linux, Unix or a Mac programmer?
Sally
-
May 24th, 1999, 10:38 PM
#18
Re: Help! How to send a CTRL+X key to another window?
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".
-
May 24th, 1999, 10:47 PM
#19
About Linux
Hey, I am a faithful linux fan.I am now studying
the network and XWindow programming. Is there anybody interested in these?
-
June 29th, 1999, 03:08 AM
#20
Re: Help! How to send a CTRL+X key to another window?
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;
}
}
-
November 11th, 2005, 05:09 AM
#21
Re: Help! How to send a CTRL+X key to another window?
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);
-
August 24th, 2008, 05:50 AM
#22
Re: Help! How to send a CTRL+X key to another window?
 Originally Posted by shellreef
Get the hwnd of the window you want to send the keys to (for example CWnd* pWnd = CWnd::FindWindow(NULL, "Untitled - Notepad"), and then post or send a WM_CHAR message to it. For example:
[ccode]
// Get the window that we want to send Ctrl+X to. In this example 'pWnd' will be set to
// the edit control in Notepad (dialog ID 0x0F). Change this.
CWnd* pWnd = CWnd::FindWindow(NULL, "Untitled - Notepad");
if (pWnd)
{
pWnd = pWnd->GetDlgItem(0x0F);
} else {
AfxMessageBox("Can't find notepad");
exit(0);
}
pWnd->SendMessage(WM_CHAR, 24, 0, 0); // 24 = Ctrl+X
Hope this helps.
Can you pls tell how did you get this 24 equelent fo Ctrl + X ?
"Don't Bring A Knife To A Gun Fight"
-
August 24th, 2008, 09:07 AM
#23
Re: Help! How to send a CTRL+X key to another window?
Since Shellreef hasn't posted for over 9 years, I wouldn't waste a lot of time waiting for a response.
-
August 24th, 2008, 09:18 AM
#24
Re: Help! How to send a CTRL+X key to another window?
oh, is this thread 9 years old, oh then they are now too old to post a reply
"Don't Bring A Knife To A Gun Fight"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|