Re: Modeless Dialogs and WM_CHAR

From: Callum Winter (callum_at_REMOVE_THISwinter9999.fsnet.co.uk)
Date: 02/01/05


Date: Tue, 1 Feb 2005 13:23:04 -0000


> This is the part of your question that that I don't get. Keystroke
messages
> go to the window with the focus, no? And if you have a modeless dialog you
> are pumping messages something like this

yes

>
> if ( !IsDialogMessage(hMyDialog, &msg) )
> {
> TranslateMessage(&msg);
> DIspatchMessage(&msg);
> }
>
> No?

Yup exactly like that but i dont get the keystroke messages, when the
application window has focus.

> If you want to capture the keystrokes in a window of a class whose window
> procedure you did not write the usual tack would be to subclass the
window,
> respond to the WM_GETDLGCODE message to tell the dialog manager which
> keystroke messages you are interested in, and do what you like in the
> subclassed window procedure. Developers do this _all the time_ to bring
> special functionality to edit controls, for example.

So your saying the default behaviour of a modeless dialog created with
CreateDialog() is not to receive WM_CHAR in fact not to recieve any
keystroke messages in the callback, and i need to subclass the dialog so I
can respond to WM_GETDLGCODE to make it generate them.??.

I own Charles Petzold Fifth Edition but cant find anything on WM_GETDLGCODE
in there (at least its not mentioned in the index), guess Im stuck with the
online docs, for this one. oh well.

>
> Another option is to install a _thread-specific_ keyboard hook - check the
> docs for SetWindowsHookEx(WH_KEYBOARD, ...). With it you can get first
crack
> at _all_ keystrokes going to _all_ windows in a therad.

This sounds interesting, ill have a look at that aswell.

Thanks for the advice, at least I have something to go on now.
Callum.



Relevant Pages

  • Re: WinXP Batch File ???
    ... Try running the "repair icons" option on the repair node of TweakUI. ... >> 0 Hides the window and activates another window. ... >> compared to the title string of each running application. ... >> You can use SendKeys to send more than one keystroke at a time. ...
    (microsoft.public.windowsxp.general)
  • Re: WinXP Batch File ???
    ... the icons are not damaged: in fact they are visible in the original ... >>> 0 Hides the window and activates another window. ... >>> compared to the title string of each running application. ... >>> You can use SendKeys to send more than one keystroke at a time. ...
    (microsoft.public.windowsxp.general)
  • Re: Does XP have any built in macro facility?
    ... Hides the window and activates another window. ... any application whose title string begins with title is activated. ... Most keyboard characters are represented by a single ... You can use SendKeys to send more than one keystroke at a time. ...
    (microsoft.public.windowsxp.general)
  • Re: Net traffic monitor
    ... I have and used Keystroke for a number of years, ... active app windows). ... Or is it written to a normal command output window (in ...
    (comp.sys.acorn.networking)
  • Re: Detecting Enter key in listview control
    ... I only get LVN_ITEMACTIVATE for the Enter key if I subclass ... done that I might as well get the keystroke in the subclass proc. ... >> How do you detect an Enter keystroke in a listview control. ... >> David Liebtag ...
    (microsoft.public.win32.programmer.ui)