To ensure your application uses the new appearance style in Windows XP, you need a declaration to specify the dependency on ComCtl32 version 6 to ensure linking to ComCtl32. If you have any self-drawn controls, in the future you should draw them through uxtheme.dll instead of drawing them yourself. You should do this if you want them to look similar to other parts of the UI.
The following code draws a theme-aware button:
rtButton.top = 100;
rtButton.left = 10;
rtButton.bottom = 130;
rtButton.right = 200;
hTheme = OpenThemeData(hWnd, L"Button");
DrawThemeBackground(hTheme, hdc, BP_PUSHBUTTON, PBS_NORMAL, &rtButton, NULL);
DrawThemeText(hTheme, hdc, BP_PUSHBUTTON, PBS_NORMAL, wzTMB, wcslen(wzTMB),
DT_CENTER | DT_VCENTER | DT_WORD_ELLIPSIS | DT_SINGLELINE, 0, &rtButton);
A common reason for creating a self-drawn button is to add a bitmap. Now, buttons in ComCtl32 version 6 can incorporate bitmaps provided by developers by associating with an image list. Whether you are updating an existing application or writing a new one, be sure to use the ComCtl32 version 6 declaration and test your application with version 5 to see how your windows, dialogs, and the new appearance work together.
The following code draws a button with a bitmap:
Button_ImageList.himl = himl;
Button_ImageList.uAlign = BUTTON_IMAGELIST_ALIGN_LEFT;
Button_ImageList.margin.top = 3;
Button_ImageList.margin.bottom = 3;
Button_ImageList.margin.left = 3;
Button_ImageList.margin.right = 3;
hwndImageBtn = CreateWindow(L"Button",wzText,WS_CHILD | BS_PUSHBUTTON,0,0,0,0,hWndParent,NULL,hInst,NULL);
Button_SetImageList(hwndImageBtn, &Button_ImageList);
Button_GetIdealSize(hwndImageBtn, &sizeBtn);
SetWindowPos(hwndImageBtn, hWndParent, 10, 10, sizeBtn.cx, sizeBtn.cy, SWP_SHOWWINDOW | SWP_NOZORDER | SWP_NOACTIVATE);