XP风格的Win32状态栏
我尝试创建一个带有状态栏的窗口:
#include <commctrl.h>
InitCommonControls();
hStatus = CreateWindowEx(
0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP,
0, 0, 0, 0, hWnd, (HMENU)IDC_MAIN_STATUS, GetModuleHandle(NULL), NULL);
int statwidths[] = {100, -1};
SendMessage(hStatus, SB_SETPARTS, sizeof(statwidths)/sizeof(int), (LPARAM)statwidths);
一切都很好,除了它是用经典风格而不是 XP 风格绘制的。
请问如何让它以XP风格出现?我是否必须定义一些#define _WIN32_IE 0x0500(我已经有了)?
我使用 MinGW,如果这有什么影响的话......
I try to create a window with a status bar:
#include <commctrl.h>
InitCommonControls();
hStatus = CreateWindowEx(
0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP,
0, 0, 0, 0, hWnd, (HMENU)IDC_MAIN_STATUS, GetModuleHandle(NULL), NULL);
int statwidths[] = {100, -1};
SendMessage(hStatus, SB_SETPARTS, sizeof(statwidths)/sizeof(int), (LPARAM)statwidths);
Everything's ok, except it is drawn in Classic style, rather than in XP style.
Please, how to make it appear in XP style? Do I have to define some #define _WIN32_IE 0x0500 (which I already have)?
I use MinGW, if that effects anything...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要添加应用程序清单以告诉它使用 V6 通用控件而不是 V5。
编辑:有一篇 MSDN 文章有关如何执行此操作的信息,包括有关如何创建和使用清单的部分。事实上,还有很多关于它的 MSDN 文章,但我认为这篇文章足以涵盖这个主题......
You need to add an application manifest to tell it to use the V6 common controls instead of the V5.
Edit: There's an MSDN Article on how to do this, including a section on how to create and use a manifest. Actually, there are quite a few more MSDN articles on it as well, but I think this one covers the subject sufficiently...
正如 Jerry 所提到的,您的应用程序需要一个清单文件。这里有两个链接解释如何创建它们。
http://msdn.microsoft.com/en- us/library/ms649781%28VS.85%29.aspx
http ://msdn.microsoft.com/en-us/library/ms997646.aspx
一如既往,MSDN 是您的朋友
As mentioned by Jerry, you need a manifest file for your application. Here are two links which explain how to create them.
http://msdn.microsoft.com/en-us/library/ms649781%28VS.85%29.aspx
http://msdn.microsoft.com/en-us/library/ms997646.aspx
As usual MSDN is your friend