Search code examples
crashribbon

"Encountered an improper argument" running a Windows XP MFC Ribbon Application


I have developed a Ribbon application on Vista using VS 2008. It works fine on Vista. I statically link MFC so that I can run it on XP too.

But when I run it on XP, it puts up a dialog box saying "A required resource was unavailble". Later if I press OK on this dialog, it puts up another one saying "Encountered an improper argument". Many such("Encountered an....") dialogs follow(one after another) until I terminate it from the task manager.

Interesting thing I noticed is that this scenario occurs when I just place the mouse pointer over the Ribbon bar. I do nothing else. Then I open the Task manager and see that the memory used is increasing by 8 bytes with every second. Eventually followed by the above scenario.

?????


Solution

  • There was a resource leak in my code that was causing this problem.

    I had called GetDC() while updating the ribbon bar controls(ON_UPDATE_COMMAND_UI), but had not released it. Releasing it using ReleaseDC(..) fixed the issue.

    Thanks for all replies.