开发者

Win32 status bar with XP style

开发者 https://www.devze.com 2022-12-08 10:12 出处:网络
I try to create a window with a status bar: #include <commctrl.h> InitCommonControls(); hStatus = CreateWindowEx(

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[] = {开发者_C百科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...


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...


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

0

精彩评论

暂无评论...
验证码 换一张
取 消