Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PeekMessage loop

Posted on 1999-07-28
2
Medium Priority
?
1,084 Views
Last Modified: 2013-12-03
I've got a app whose main window I'm subclassing.  In response to a specific message, I sit in a PeekMessage loop for a while.  While in the PeekMessage loop everything is fine except for the fact that keyboard accelerators don't work.  Menus can be accessed with Alt-key combinations, general keyboard messages are processed, etc., but menu command shortcuts and other accelerators aren't getting called.  My PeekMessage loop looks similar to the following:

MSG msg;
while (bStayInLoop)
{
   DoStuff();

   if (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
   {
      if (msg.message == WM_QUIT ||
          msg.message == WM_DESTROY ||
          msg.message == WM_CLOSE)
      {
         bStayInLoop = FALSE;
      }

      TranslateMessage (&msg);
      DispatchMessage (&msg);
   }
}

What am I missing here?
0
Comment
Question by:The Master
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 400 total points
ID: 1403973
hAccelTable = LoadAccelerators (hInstance, Name);

while()
//...
if (!TranslateAccelerator (msg.hwnd, hAccelTable, &msg)) {
         TranslateMessage(&msg);
         DispatchMessage(&msg);
      }
0
 
LVL 2

Author Comment

by:The Master
ID: 1403974
That's what it was.  Thanks!
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question