关于MessageBox不显示的问题
我写了一个win32的应用程序,自己创建了一个窗口,点击鼠标左键的时候,调用MessageBox会弹出一个窗口来,本来没什么问题。但是我将外部的一个资源(就是windows扫雷的资源)添加进工程以后,就只能听到对话框“嘟”的一声,但是对话框却没有显示,这到底是怎么回事啊?
到弄了几天都没有弄出来,各位大哥帮帮忙吧
[解决办法]
InitCommonControls
InitCommonControls() is required on Windows XP if an application manifest specifies use of ComCtl32.dll version 6 or later to enable visual styles. Otherwise, any window creation will fail.
The text below is form MSDN:
Registers and initializes certain common control window classes. This function is obsolete. New applications should use the InitCommonControlsEx function
Under Comctl32.dll version 5.x, only Microsoft Windows 95 classes (ICC_WIN95_CLASSES) can be registered through InitCommonControls. Programs which require additional common control classes must use the InitCommonControlsEx function.
Under Comctl32.dll version 6.0 and later, InitCommonControls does nothing. Applications must explicitly register all common controls through InitCommonControlsEx.
因为通用控件的数量非常多,把它们全部装入内存并注册它们是非常浪费内存的。除了“RTF文本编辑”控件外其他控件的可执行代码都放在comctl32.dll中,这样其他的应用程序就可以使用它们了。“RTF文本编辑”控件在richedXX.dll中,由于该控件非常的复杂,所以也比其它控件大。 要加载comctl32.dll可以在您的应用程序中调用函数InitCommonControls。InitCommonControls函数是动态链接库comctl32.dll中的一个函数,只要在您的程序中的任意地方引用了该函数就、会使得WINDOWS的程序加载器PE Loader加载该库。函数InitCommonControls其实只有一条指令“ret”,它的唯一目的是为了使得在调用了个该函数的应用程序的可执行文件的PE头中的“引入”段中包含有comctl32.dll,这样无论什么时候该应用程序都会为您加载该库。所以真正初始化的工作是在该库的入口点处做的,在这里会注册所有的通用控件类,然后所有的通用控件就可以在这些类上进行创建,这就象创建其它的子窗口控件一样。