Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Programming. | 3 guests |
Acmlm's Board - I2 Archive - Programming - Earth to keyboard... come in keyboard... | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 5293/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Well I created this dialog from a resource, with nothing on it, and it worked fine. Stuck in a child window (also nothing on it, but with horizontal and vertical scrollbars) and all was well. After adding some static textboxes to the main dialog, though, the windows no longer recieve WM_KEYDOWN messages. Plus even when they did, it would beep whenever I pressed a key... how do I get the keys working again and not beeping? [edit] Also, it seems only the child window is getting WM_MOUSEMOVE messages... I don't have any need for the parent to get them yet though. (edited by HyperHacker on 06-27-05 03:40 AM) |
|||
beneficii Lakitu Level: 36 Posts: 216/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours |
| ||
Originally posted by HyperHacker EDIT 2: By static textboxes, do you mean edit controls whose text is unchangeable? My best guess is that you want to make sure to set focus to the parent dialog, because I don't think that WM_KEYDOWN gets sent if the focus is on an edit control. Every time a text box comes into focus (gotten from the messages), do: SetFocus(dialoghwnd); That should prevent the edit boxes from staying in focus. EDIT: I had this similar problem in my SMB3 editor, with the combobox retaining focus and preventing my WM_KEYDOWN messages from reaching the WndProc, which prevented the user from scrolling the map box, so I made so that everytime the combobox closed up, the parent window would get the focus (i.e. I wrote the SetFocus(hwnd) under CBN_CLOSEUP). (edited by beneficii on 06-27-05 09:42 AM) (edited by beneficii on 06-27-05 09:47 AM) |
|||
sloat Level: 16 Posts: 65/85 EXP: 18044 For next: 2212 Since: 05-21-04 From: South Central Delaware Since last post: 19 days Last activity: 5 hours |
| ||
I think adding any child window (except maybe static) stops the system from sending keyboard messages to a dialog. The only way I could ever get around this was with a keyboard hook. Mouse messages are not sent to multiple windows by default. If you want to move the mouse over a child window and have the parent know about it, check out the SetCapture function. |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 5296/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
By static I mean just plain Static controls. I've tried everything I could think of involving SetFocus. They all use the same message handler anyway. | |||
beneficii Lakitu Level: 36 Posts: 220/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours |
| ||
Originally posted by HyperHacker Hmmm. You could try drawing the text directly onto the dialog itself. I don't know exactly how to do it, since I never did it before, but I know a source that can teach you: http://www.winprog.org/tutorial/fonts.html Regarding using the same message handler, not necessarily. If, say, a combobox has the focus, then the WndProc won't get WM_KEYDOWN messages during that period. (edited by beneficii on 06-27-05 05:15 PM) |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 5323/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
I really can't imagine having to not use any controls at all just to get keyboard input. There must be some focus issue I'm missing here. Also how do I create an invisible brush? A pen I can do but MSDN doesn't seem to have any such information on brushes. I'm trying to draw a dashed line, so I created a dashed pen for it, but in between the dashes it draws white where I don't want it to draw at all. I assume it's using the default brush for this... |
|||
Cellar Dweller Flurry !!! Level: 27 Posts: 232/269 EXP: 107817 For next: 8342 Since: 03-15-04 From: Arkansas Since last post: 16 days Last activity: 34 min. |
| ||
Regarding the gaps in the line, you may want to check out the SetBkMode function. You don't need an invisible brush to make the gaps in the line invisible, but if you need one for some other use, use GetStockObject. | |||
sloat Level: 16 Posts: 66/85 EXP: 18044 For next: 2212 Since: 05-21-04 From: South Central Delaware Since last post: 19 days Last activity: 5 hours |
| ||
Originally posted by HyperHacker SetFocus doesn't work with modal dialogs because the default dialog procedure sends the focus to the first control or something like that. I don't think drawing fake controlls will work out very well. The best way to do it may be to set up a Keyboard Hook with SetWindowsHookEx. It may be the only way, in fact. I don't think subclassing each control and forwarding the messages would get anywhere. |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 5327/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
But if I use a keyboard hook, it'll respond to keys pressed in other windows, and will only work in XP. | |||
beneficii Lakitu Level: 36 Posts: 229/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours |
| ||
Originally posted by HyperHacker It's not that hard to draw text onto a screen, is it? |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 5346/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
No but A, it shouldn't be necessary, and B, I would have to 'mimic' any control I add like that. Static is easy, some others aren't. Small scrollbar problem. Whatever I set the Page value to, the maximum goes down by. Say the bar has a max of 10 and a Page of 2, it won't go past position 8. Setting Page to 0 fixes this but makes it that I can't click the bar area itself to scroll quickly. |
|||
sloat Level: 16 Posts: 69/85 EXP: 18044 For next: 2212 Since: 05-21-04 From: South Central Delaware Since last post: 19 days Last activity: 5 hours |
| ||
Originally posted by HyperHacker That's not entirely correct. The low-level hooks can only be used on NT based systems, and they are also system-wide hooks only. A regular keyboard hook can be used across all Win32 platforms afaik, and can also be applied to a single thread. And because the thread is in the same process, the hook callback and be in the code and doesn't need its own dll. (edited by sloat on 06-29-05 02:44 PM) |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 5356/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
I don't think I've ever heard of a keyboard hook that works on all versions and doesn't trigger from other windows. What function should I be looking at? | |||
sloat Level: 16 Posts: 70/85 EXP: 18044 For next: 2212 Since: 05-21-04 From: South Central Delaware Since last post: 19 days Last activity: 5 hours |
| ||
GetWindowThreadProcessId to get the thread id of the window, SetWindowsHookEx and use the WH_KEYBOARD hook with the KeyboardProc callback. And don't forget CallNextHookEx and UnhookWindowsHookEx. Seems daunting, but it isn't really. This may help as well. |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 5374/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Heh, I thought that was for global hooks. BTW, SetBkMode did the trick for the lines. [edit] Eh, problem. With the keyboard hook, it duplicates every keypress. And it still beeps! (edited by HyperHacker on 06-30-05 09:11 AM) |
|||
sloat Level: 16 Posts: 71/85 EXP: 18044 For next: 2212 Since: 05-21-04 From: South Central Delaware Since last post: 19 days Last activity: 5 hours |
| ||
It duplicates because it calls the callback separately for keydown and keyup events. It beeps because dialog windows aren't supposed to receive keyboard input like that. I don't know how to get rid of that myself, so good luck. (edited by sloat on 06-30-05 03:39 PM) |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 5397/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Ah, yes, it's easy enough to stop the duplicating once I actually read the article a little closer. Just need to treat press and release separately (bit 31 of lParam). Still beeps though. |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Programming - Earth to keyboard... come in keyboard... | | | |