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
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
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."
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?
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
SetFocus did the trick....
Thanks once again!
See ya,
Ben
Old thread but same problem. SetFocus was the solution. :lol: