Windows 95 theme:
Windows 10 theme:
The Windows 95 theme look would be absolutely perfect for my program. Is there a way to do this using the Win32 API and GDI+ which the program is written in?
You can use SetWindowTheme function
Properties->Linker->Input->Additional Dependencies
.
SetWindowTheme(hwnd, L" ", L" ");
after you create the window.Here is the sample:
#include <windows.h>
#include <Uxtheme.h>
LPCWSTR g_szClassName = L"myWindowClass";
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX wc;
HWND hwnd;
MSG Msg;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wc.lpszMenuName = NULL;
wc.lpszClassName = g_szClassName;
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if (!RegisterClassEx(&wc))
{
MessageBox(NULL, L"Window Registration Failed!", L"Error!",
MB_ICONEXCLAMATION | MB_OK);
return 0;
}
hwnd = CreateWindow(
g_szClassName,
L"The title of my window",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 600, 600,
NULL, NULL, hInstance, NULL);
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
SetWindowTheme(hwnd, L"", L"");
while (GetMessage(&Msg, NULL, 0, 0) > 0)
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}
OutPut:
Edit:
You can refer to Visual Styles
,and in What's New
:
Through Windows 7, visual styles are on by default but the user can turn them off by selecting Windows Classic theme or by turning off the Themes service. When visual styles are off, all UI gets the classic look, and most visual styles APIs are not available. Visual styles off mode has been retained through Windows 7 to support the various high contrast themes, as well as Windows Classic theme. If you want to support both visual styles and high contrast themes in the same application, you typically need to maintain two separate code paths for rendering controls.
And if you want to enable visual styles.