Click here to Skip to main content
15,914,327 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: need help in ADO VC++ Pin
Milton Karimbekallil29-May-06 2:29
Milton Karimbekallil29-May-06 2:29 
GeneralRe: need help in ADO VC++ Pin
GANsJob1-Jun-06 3:31
GANsJob1-Jun-06 3:31 
QuestionKey handling in a windowless control Pin
TClarke25-May-06 2:41
TClarke25-May-06 2:41 
AnswerRe: Key handling in a windowless control Pin
Stephen Hewitt25-May-06 3:57
Stephen Hewitt25-May-06 3:57 
GeneralRe: Key handling in a windowless control Pin
TClarke25-May-06 6:01
TClarke25-May-06 6:01 
GeneralRe: Key handling in a windowless control [modified] Pin
Stephen Hewitt25-May-06 13:48
Stephen Hewitt25-May-06 13:48 
GeneralRe: Key handling in a windowless control [modified] Pin
TClarke25-May-06 22:49
TClarke25-May-06 22:49 
GeneralRe: Key handling in a windowless control [modified] Pin
Stephen Hewitt26-May-06 0:40
Stephen Hewitt26-May-06 0:40 
Here's how I handled a key (I'm using ATL with MSVC6 so you your mileage may vary):
First we need to add a handler for the key. Follow these steps:
 1. Right click on the control class in ClassView;
 2. Select "Add Windows Message Handles..." from the context menu;
 3. Select the "WM_CHAR" message;
 4. Press "Add and Edit".

This will add the handler and position you there in the editor. Note that so far this is the same procedure you'd follow with ATL to add a handler to any window; ATL hides the difference so you don't have to worry about the fact that your control is windowless.

Already this will create a control that can handle a key stroke although it may not seem so at first. If you load it up in IE and press a key nothing happens: this is because it isn't UI-active and hasn't got focus. If you press tab then press a key you'll notice the key stroke gets handled – if not repeat. Eventually you’ll hit the right control and it will process the keystroke. The problem is clicking on the control doesn't activate it as expected. To rectify this you can add a mouse click handler and call SetControlFocus(TRUE); (inherited from CComControlBase) in the handler .

Hope this helps.


Steve
GeneralRe: Key handling in a windowless control [modified] Pin
TClarke26-May-06 1:01
TClarke26-May-06 1:01 
GeneralRe: Key handling in a windowless control [modified] Pin
Stephen Hewitt28-May-06 22:49
Stephen Hewitt28-May-06 22:49 
GeneralRe: Key handling in a windowless control [modified] Pin
TClarke29-May-06 23:36
TClarke29-May-06 23:36 
GeneralRe: Key handling in a windowless control [modified] Pin
Stephen Hewitt30-May-06 13:45
Stephen Hewitt30-May-06 13:45 
GeneralRe: Key handling in a windowless control [modified] Pin
TClarke31-May-06 0:21
TClarke31-May-06 0:21 
GeneralRe: Key handling in a windowless control [modified] Pin
Stephen Hewitt31-May-06 13:43
Stephen Hewitt31-May-06 13:43 
GeneralRe: Key handling in a windowless control [modified] Pin
TClarke31-May-06 23:53
TClarke31-May-06 23:53 
GeneralRe: Key handling in a windowless control [modified] Pin
Stephen Hewitt1-Jun-06 14:05
Stephen Hewitt1-Jun-06 14:05 
GeneralRe: Key handling in a windowless control [modified] Pin
TClarke1-Jun-06 23:24
TClarke1-Jun-06 23:24 
GeneralRe: Key handling in a windowless control [modified] Pin
Stephen Hewitt5-Jun-06 14:27
Stephen Hewitt5-Jun-06 14:27 
GeneralRe: Key handling in a windowless control [modified] Pin
TClarke5-Jun-06 23:01
TClarke5-Jun-06 23:01 
GeneralRe: Key handling in a windowless control [modified] Pin
Stephen Hewitt6-Jun-06 1:33
Stephen Hewitt6-Jun-06 1:33 
GeneralRe: Key handling in a windowless control [modified] Pin
TClarke6-Jun-06 2:02
TClarke6-Jun-06 2:02 
GeneralRe: Key handling in a windowless control [modified] Pin
Stephen Hewitt6-Jun-06 3:25
Stephen Hewitt6-Jun-06 3:25 
GeneralRe: Key handling in a windowless control [modified] Pin
TClarke6-Jun-06 3:40
TClarke6-Jun-06 3:40 
QuestionBandObject Question [modified] Pin
hung_ngole25-May-06 1:53
hung_ngole25-May-06 1:53 
QuestionSendMessage not working Pin
HarishDixit25-May-06 0:24
HarishDixit25-May-06 0:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.