Accelerators in modeless dialog boxes

Accelerators in modeless dialog boxes

Post by Nestor Dut » Wed, 09 Aug 1995 04:00:00



I have an SDI application that launches other modeless dialog (derived from
CDialog). The SDI application has an accelerator defined (VK_F6). What do I
need to do to have the F6 key being hit when the modeless dialog is active to
get the accelerator?

Thanks in advance,
-- Nestor

 
 
 

Accelerators in modeless dialog boxes

Post by David Webbe » Wed, 09 Aug 1995 04:00:00




Quote:> I have an SDI application that launches other modeless dialog (derived from
> CDialog). The SDI application has an accelerator defined (VK_F6). What do I
> need to do to have the F6 key being hit when the modeless dialog is active to
> get the accelerator?

Read the article by Paul Di Lascia in a recent MSJ (July I think).
It is extremely good on message direction and accelerators in MFC.
It is also very readable.

Dave
--
+---------------------------+-----------------------------------+

| Author of MOZART, the Windows 3.1 shareware Music Processor   |
| and member of the Association of Shareware Professionals      |
+---------------------------+-----------------------------------+

 
 
 

1. Using accelerators when a modeless dialog box is the main window

I'm writing a control panel that uses a modeless dialog box as its main
window.  Somehow I can't seem to trap the accelerator keys.  Here's the
beginning part:

case CPL_DBLCLK:
        CreateDialog(hinst, MAKEINTRESOURCE(IDD_MAIN), hwndCPl,
(DLGPROC)DialogProc);
        hAccelTable = LoadAccelerators(hinst, MAKEINTRESOURCE(IDR_ACCELERATOR));
        while (GetMessage(&msg, NULL, 0, 0))
        {
                if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
                {
                        TranslateMessage(&msg);
                        DispatchMessage(&msg);
                }
        }
        break;

Then in the DialogProc, I try to get the message:

switch(uMsg)
{
        .
        .
        case WM_COMMAND:
                switch(LOWORD(wParam))
                {
                        .
                        .
                        case IDM_MYMENUITEM:
                                MessageBox(GetFocus(), "Hello", "Test", MB_OK);
                                break;
                }
                break;

It doesn't work, though.  What am I missing?

Thanks,
Dave Herman

http://www.microcosm.com/~dave

To e-mail me, delete the underscore
at the end of my e-mail address.

2. How to make an internal clock for the STe?

3. How do you handle Accelerators in modeless dialog boxes using SDK?

4. Firewalls based on NT

5. Accelerators + Modeless Dialog Boxes == 0????

6. what are the valid ranges for XMS EMB handles?

7. Processing keyboard accelerators with modeless dialog boxes

8. IRQ-9 mystery

9. Calling a modeless dialog box from a modal dialog box

10. Modeless dialog out of a Modal dialog box: possible?

11. Modeless Dialog in another modeless Dialog

12. Accelerators for Dialog box (as main Window)

13. Accelerators and Dialog boxes