Windows programming

Moderators: None (Apply to moderate this forum)
Number of threads: 3711
Number of posts: 9173

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Problem with repeat count of keyboard input (win 32) Posted by vibha on 20 Aug 2001 at 4:04 AM
Hi ,

I've created a modeless DialogBox as main window using
"CreateDialogParam(...)" with an Edit control. When I type in from keyboard , each single character automatically gets repeated 4 times.
I tried to trap WM_KEYDOWN and WM_CHAR message in WndProc of DialogBox but it does not seem to receive these messages.

Please help me in turning off this AutoRepeat feature.

Thanks a lot

Report
Re: Problem with repeat count of keyboard input (win 32) Posted by weicco on 20 Aug 2001 at 5:12 AM
: Hi ,
:
: I've created a modeless DialogBox as main window using
: "CreateDialogParam(...)" with an Edit control. When I type in from keyboard , each single character automatically gets repeated 4 times.
: I tried to trap WM_KEYDOWN and WM_CHAR message in WndProc of DialogBox but it does not seem to receive these messages.
:
: Please help me in turning off this AutoRepeat feature.
:
: Thanks a lot
:

Windows send always WM_KEYDOWN message to every window when key is pressed (and window is active of course). I don't quite remember how the messaging system works but I think if you try to intercept those messages from DialogBox it doesn't work. You should override Edit control's wndproc or something. If you are using MFC this should be easy.

But I think you should find out the reason why characters duplicates. Is your keyboard repeat delay too short?

Report
Re: Problem with repeat count of keyboard input (win 32) Posted by vibha on 20 Aug 2001 at 5:55 AM
: : Hi ,
: :
: : I've created a modeless DialogBox as main window using
: : "CreateDialogParam(...)" with an Edit control. When I type in from keyboard , each single character automatically gets repeated 4 times.
: : I tried to trap WM_KEYDOWN and WM_CHAR message in WndProc of DialogBox but it does not seem to receive these messages.
: :
: : Please help me in turning off this AutoRepeat feature.
: :
: : Thanks a lot
: :
:
: Windows send always WM_KEYDOWN message to every window when key is pressed (and window is active of course). I don't quite remember how the messaging system works but I think if you try to intercept those messages from DialogBox it doesn't work. You should override Edit control's wndproc or something. If you are using MFC this should be easy.
:
: But I think you should find out the reason why characters duplicates. Is your keyboard repeat delay too short?
:

My program works fine if I create a modal DialogBox using DialogBox(..) or Window using CreateWindow(...) .

Any suggestions ???


Report
Re: Problem with repeat count of keyboard input (win 32) Posted by AsmGuru62 on 20 Aug 2001 at 7:00 AM
MFC or not MFC?

On more serious note - I never heard of such trick! I am curious myself, because I love unusual bugs... Can you post a code here or ar 'codexxi@accessv.com'?

Report
Re: Problem with repeat count of keyboard input (win 32) Posted by vibha on 20 Aug 2001 at 9:36 PM
: MFC or not MFC?
:
: On more serious note - I never heard of such trick! I am curious myself, because I love unusual bugs... Can you post a code here or ar 'codexxi@accessv.com'?
:

Problem was in this code to handle message dispatching

while (GetMessage(&msg, NULL, 0, 0))
{
if (IsDialogMessage(hDlg, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}

MSDN HELP says
Because the IsDialogMessage function performs all necessary translating and dispatching of messages, a message processed by IsDialogMessage must not be passed to the TranslateMessage or DispatchMessage function.
The correct code will be:

if (! IsDialogMessage(hDlg, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}

Thanks AsmGuru62



Report
Re: You are welcome, and... Posted by AsmGuru62 on 21 Aug 2001 at 7:17 AM
What is it can be done in custom dialog class which cannot be done in a standard dialog class?


Report
Re: Problem with repeat count of keyboard input (win 32) Posted by brigsoft on 25 Aug 2001 at 11:01 PM
Yes,
WM_KEYDOWN sends to window that has focus.
Focus is on child window (edit control)
You can get Child window ID, after - handle.
Make your WinProc for this window
and work with it.

Alex
http://www.brigsoft.com

: Hi ,
:
: I've created a modeless DialogBox as main window using
: "CreateDialogParam(...)" with an Edit control. When I type in from keyboard , each single character automatically gets repeated 4 times.
: I tried to trap WM_KEYDOWN and WM_CHAR message in WndProc of DialogBox but it does not seem to receive these messages.
:
: Please help me in turning off this AutoRepeat feature.
:
: Thanks a lot
:





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.