Hi there, I wrote my own custom control in asm by registering a class with RegisterClassEx and my own proc. No by default only certain messages seem to be sent to it like WM_PAINT, WM_CREATE, WM_DESTROY, etc... but I'm not recieving WM_KEYDOWN, WM_KEYUP, or any keyboard input codes. I also noticed that if you subclass a static control you don't get those either, but if you subclass a button you do!?!? How do I set which messages a control will recieve? Thanks, Ben
Posted on 2001-03-31 16:50:00 by cyberben
Ben, From experience, the best approach to designing a custom control is to start with a bare CreateWindowEx window as you have no restrictions at all. I have done one as an example in the MASM32 example code that works well with 2 bitmaps as a button and it was coded from scratch. In the longer term, you have a lot less hassles when you don't start with the assumptions built into standard controls. Regards, hutch@pbq.com.au
Posted on 2001-03-31 16:58:00 by hutch--
In order to receive keyboard messages like WM_KEYDOWN, a window needs to have the keyboard focus. You may set your window to having the focus with the SetFocus method. -------------------------- "I saw this in a movie about a bus that had to speed around a city, keeping its speed over fifty, and if it's speed dropped, it would explode! I think it was called "The bus that couldn't slow down."
Posted on 2001-03-31 20:47:00 by Ernie
Doesn't the TranslateMessage function translate WM_KEYUP WM_KEYDOWN messages into WM_CHAR messages? This might be the reason you are not recieving those messages, but i am not sure?
Posted on 2001-03-31 22:08:00 by George
I have started from scratch with a CreateWindowEx function but it's still not getting the keyboard stuff, I'll look over it again and try setting the keyboard focus. Then I'll post again. Thanks for the pointers. - Ben
Posted on 2001-03-31 23:26:00 by cyberben
SetFocus did the trick.... Thanks once again! See ya, Ben
Posted on 2001-03-31 23:51:00 by cyberben
Old thread but same problem. SetFocus was the solution.  :lol:
Posted on 2011-03-05 08:45:02 by Nordwind64