Hello again. I have a window with several controls on it. Now I want to recieve ALL keydown events in the main window callback procedure. In Visual Basic you simply set a property of the window so that it receives all keyboard input even if a child control has the focus. How do I do this in assembler? I mean other than subclassing each control so that they pass on the characters they receive... that'd be too much work. Thanks, Ben
Posted on 2000-12-02 18:14:00 by cyberben
Ben, There are a couple of approaches, you can make a common subclass for all of the controls or process the WM_KEYDOWN/UP mesage directly in the mesage loop. Both have there advantages and disadvantages. With a common subclass, grouping controls of the same type is easy enough to do and is generally very reliable but it can cause unusual crashes if you mix the control types if you are not careful. For example, you may have a number of edit controls in a dialog that all need the same filtering through the WM_CHAR message, this is an ideal application for a common subclass for all of them. To do the same directly in the message loop, you must use the direct MSG structure component names to trap the messages you need. Regards, hutch@pbq.com.au
Posted on 2000-12-02 19:40:00 by hutch--
Well I figured out an esier way around the problem. What I have is a split bar on my window which I want the user to be able to drag up and down to resize the ratio of a ListView and a frame at the top. That all works, but now I want to be able to drive this split bar with the keyboard as this program will most likely run on a lot of laptops. So I made a menu item which started the draging of the split and I was trapping some keydown's in the main message loop which would move the split up and down. Now when the ListView or ToolBar or any of those had the focus I wouldn't receive the keydown's so in the menu item which beggins the dragging of the split I call SetFocus to my main window. Which works great. Now I've got a fully functioning split bar, with a focus rect and everything! Looks very nice... Thanks to everyone who's helped me with my problems! See ya, Ben
Posted on 2000-12-03 14:06:00 by cyberben