Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

handling and processing accelerator messages

12 views
Skip to first unread message

Mohammad Shahzad Saleem

unread,
Feb 4, 2003, 1:40:11 PM2/4/03
to
hi,
how can i add the handler to the accelerator messages in the atl control? i
want to process the key combinations pressed on the keyboard, like Alt+M for
some thing. i have added an accelerator table in the resources with few
accelerator entries and loading it in the method "GetControlInfo". i dont
know how to add the handler to the acceleratr messages. please give me some
suggestion ...

Regards
Shahzad


Igor Tandetnik

unread,
Feb 4, 2003, 4:32:03 PM2/4/03
to
Override CComControl::PreTranslateAccelerator. Since you have an HACCEL
table, you can use ::TranslateAccelerator API there to generate an
appropriate WM_COMMAND message (assuming your control is windowed).
--
With best wishes,
Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken

"Mohammad Shahzad Saleem" <shah...@systemsltd.com.pk> wrote in message
news:uRdAdxHzCHA.2296@TK2MSFTNGP10...

Mohammad Shahzad Saleem

unread,
Feb 5, 2003, 4:23:28 AM2/5/03
to
its empty, please resend the message.


Igor Tandetnik

unread,
Feb 5, 2003, 9:57:34 AM2/5/03
to
Huh?

--
With best wishes,
Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken

"Mohammad Shahzad Saleem" <shah...@systemsltd.com.pk> wrote in message

news:#Q28BfPzCHA.1636@TK2MSFTNGP10...

Mohammad Shahzad Saleem

unread,
Feb 8, 2003, 8:10:53 AM2/8/03
to
I have written PreTranslateAccelerator function in the control class but it
is not getting called. I have check it into the msdn, i think
PreTranslateAccelerator is not the member of CComControl or even any other
class.

Please tell me the steps to achieve the keyboard accelerators get processed.
I dont know when & where to call the TranslateAccelerator API. and how to
handle the WM_COMMAND Message in ActiveX control.
I read about message pump while searching the web and consulting the msdn.
it is written there that messaeg pump should be placed in the WinMain. i
dont find any relationg of WinMain to the ActiveX Control.

Everybody talks about that the key combinations like Ctrl+O, ALT+M etc can
be processed using accelerator tabel in the ActiveX control. but when it
comes to explain they end up explaining how to handle Tab, Enter and Esc
keys. I am stuck at this point i wonder wehat the heck is this.
i am developing multi-lingual edit box and editor control.. in that control
i need to trap keys pressed on keyboard in combination for marking the text,
changing editing modes and switching between the languages during run time.
I dont believe that Ctrl+C, Ctrl+V & Ctrl+X keys have never been implemented
in windows standard edit boxes! then why cant i ...?

please give me usefull suggestions
i will be greatfull.

Regards
Mohammad Shahzad Saleem

"Igor Tandetnik" <itand...@whenu.com> wrote in message
news:uq1FSTJzCHA.1924@TK2MSFTNGP12...

Igor Tandetnik

unread,
Feb 18, 2003, 2:34:36 PM2/18/03
to
"Mohammad Shahzad Saleem" <shah...@systemsltd.com.pk> wrote in message
news:OG7vHM3zCHA.1636@TK2MSFTNGP10...

> I have written PreTranslateAccelerator function in the control class
but it
> is not getting called. I have check it into the msdn, i think
> PreTranslateAccelerator is not the member of CComControl or even any
other
> class.

It's there in the ATL source code, and it does get called. Maybe yours
has an incorrect signature. It should be

BOOL PreTranslateAccelerator(LPMSG pMsg, HRESULT& hRet);

You return TRUE if you have processed the message and FALSE otherwise.
If you return TRUE, you should also set hRet to an appropriate COM error
code (most often S_OK). This code is eventually returned from
IOleInPlaceActiveObject::TranslateAccelerator

> Please tell me the steps to achieve the keyboard accelerators get
processed.
> I dont know when & where to call the TranslateAccelerator API.

From PreTranslateAccelerator. It should be called if you do everything
correctly.

> and how to
> handle the WM_COMMAND Message in ActiveX control.

Just put COMMAND_ID_HANDLER macro into your message map.

> I read about message pump while searching the web and consulting the
msdn.
> it is written there that messaeg pump should be placed in the WinMain.
i
> dont find any relationg of WinMain to the ActiveX Control.

The container runs the message pump for you. You don't need to provide
your own unless you spin worker threads.

0 new messages