views:

380

answers:

2

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

+3  A: 

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 Coffin
Needs more explanation about what is manifest, but +1 anyway.
Andrejs Cainikovs
How? What is a manifest?
Ian_K
A: 

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

Pratik Bhatt
Unless it isn't ;)
Kawa