keyboard events for different CWnds

We know that BOOL CTestDialog::PreTranslateMessage(MSG *pMsg) can be
used to capture keyboard inputs for some dialog class CTestDialog and
in general any window.

But consider this..

If I have a MDI application and therein certain Key strokes 'belong' to
the mainframe and others to the child frame and perhaps certain others
to some other pane or whatever, what is the best way to implement this?

For instance, Ctrl+S saves a file in many apps (message goes to
MainFrame) and Ctrl+C copies content in the child window (message goes
to ChildFrame). What If I want customized key presses for different
tasks corresponding to different Wnd objects (each key press unique, if
really needed, to differentiate the CWnds)?

TiA,
D Rathore

0
10/30/2006 5:05:59 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
399 Views

Similar Articles

[PageSpeed] 40

>We know that BOOL CTestDialog::PreTranslateMessage(MSG *pMsg) can be
>used to capture keyboard inputs for some dialog class CTestDialog and
>in general any window.
>
>But consider this..
>
>If I have a MDI application and therein certain Key strokes 'belong' to
>the mainframe and others to the child frame and perhaps certain others
>to some other pane or whatever, what is the best way to implement this?

>For instance, Ctrl+S saves a file in many apps (message goes to
>MainFrame) and Ctrl+C copies content in the child window (message goes
>to ChildFrame).

They're normally done using keyboard accelerator resources.

>What If I want customized key presses for different
>tasks corresponding to different Wnd objects (each key press unique, if
>really needed, to differentiate the CWnds)?

You'd need to create your own mechanism for user customisation of
accelerators, but the actual keyboard handling is done for you once
you've loaded the accelerator tables you'd create.

Dave
0
davidl7375 (2060)
10/30/2006 6:43:17 PM
The best way for that is to use a Accelerator table. And handle the
different messages in the window that they belong to.

AliR.

"divya_rathore_@gmail.com" <divyarathore@gmail.com> wrote in message
news:1162227959.128583.117130@i42g2000cwa.googlegroups.com...
> We know that BOOL CTestDialog::PreTranslateMessage(MSG *pMsg) can be
> used to capture keyboard inputs for some dialog class CTestDialog and
> in general any window.
>
> But consider this..
>
> If I have a MDI application and therein certain Key strokes 'belong' to
> the mainframe and others to the child frame and perhaps certain others
> to some other pane or whatever, what is the best way to implement this?
>
> For instance, Ctrl+S saves a file in many apps (message goes to
> MainFrame) and Ctrl+C copies content in the child window (message goes
> to ChildFrame). What If I want customized key presses for different
> tasks corresponding to different Wnd objects (each key press unique, if
> really needed, to differentiate the CWnds)?
>
> TiA,
> D Rathore
>


0
AliR3470 (3236)
10/30/2006 6:45:12 PM
Reply:

Similar Artilces: