954,480 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Problem with Win32 Accelerators

Hello,
I am developing an application in Win32, ( No MFC at all ). It is an MDI application, and I am using Keyboard accelerators. The Keys that I have assigned for accelerators are working properly, but when I press something that is not an accelerator, such as Ctrl + F ( which is not an accelerator in my program ), the application freezes. Also I am using the tab key to move between child windows in the MDI child documents, and these are also working properly.

Any idea why this can happen? The code is a bit lengthy so i will not post it. If you can give me any suggestion, that alone will help.

Thanks

WolfPack
Postaholic
Moderator
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
 

It seems that the problem was with the use of IsDialogMessage( ) in the following loop.

while(GetMessage(&Msg, NULL, 0, 0) > 0)
	{
		if (!TranslateMDISysAccel(hwndClient, &Msg) && 
			!TranslateAccelerator (hwndFrame, hAccel, &Msg) &&
			!IsDialogMessage( hwndClient, &Msg ))
		{
			TranslateMessage(&Msg);
			DispatchMessage(&Msg);
		}
	}

After I commented it out, the problem with accelerators was gone. But then obviously, I cant move among the child windows of an MDI Child Window without the IsDialogMessage() function. Any recommendations on how to solve this?

WolfPack
Postaholic
Moderator
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You