“遇到不适当的争论”运行Windows XP MFC Ribbon应用程序 [英] "Encountered an improper argument" running a Windows XP MFC Ribbon Application

查看:568
本文介绍了“遇到不适当的争论”运行Windows XP MFC Ribbon应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Vista上使用VS 2008开发了Ribbon应用程序。它在Vista上正常工作。我静态链接MFC,使我可以在XP上运行它。

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.

但是当我在XP上运行它时,它会弹出一个对话框,说所需的资源是不可用的。
后来如果我在这个对话框按OK,它提出另一个说遇到不正当的参数。

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.

我注意到的有趣的事情是,这个(遇到一个....)对话框(一个接一个),直到我从任务管理器终止。方案发生时,我只是将鼠标指针放在功能区栏上。我什么也不做。然后我打开任务管理器,看到所使用的内存每秒增加8字节。

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.

推荐答案

p>我的代码中有一个资源泄露,导致这个问题。

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

我在更新功能区栏控件(ON_UPDATE_COMMAND_UI)时调用了GetDC(),但尚未发布。使用ReleaseDC(..)释放它修复了问题。

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.

感谢所有回复。

这篇关于“遇到不适当的争论”运行Windows XP MFC Ribbon应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆