Reputation:
I have searched for an answer on the Internet, but with exceptions of the difference between modal and modaless dialog boxes, I couldn't find anything useful for my question.
As written in the title, my question is - how can I implement/use a Windows version specific design for my dialog box? IOW, use the Windows 10 button style on a Windows 10 system.
I am using Visual Studio, and I have created a simple resource for my dialog using the integrated resource editor.
Here is my programm:
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, NULL);
system("pause");
return 0;
}
Right now, when I compile this code, the console and the dialog box appear on the screen, but the dialog box controls (buttons) seem to be shown in the Windows 2000 style. I'm using Windows 10.
I have this style:
I want this style:
Upvotes: 1
Views: 1268
Reputation: 101569
You need to opt in to comctl32 v6 in your manifest: Enabling Visual Styles.
To enable your application to use visual styles, you must use ComCtl32.dll version 6 or later. Because version 6 is not redistributable, it is available only when your application is running on a version of Windows that contains it. Windows ships with both version 5 and version 6. ComCtl32.dll version 6 contains both the user controls and the common controls. By default, applications use the user controls defined in User32.dll and the common controls defined in ComCtl32.dll version 5. For a list of DLL versions and their distribution platforms, see Common Control Versions.
If you want your application to use visual styles, you must add an application manifest or compiler directive that indicates that ComCtl32.dll version 6 should be used if it is available.
An application manifest enables an application to specify which versions of an assembly it requires. In Microsoft Win32, an assembly is a set of DLLs and a list of versionable objects that are contained within those DLLs.
Upvotes: 6