How do i enable Visual styles

Diya Al deen 20 Reputation points
2024-02-12T16:20:41.7866667+00:00

How Do I enable Visual styles when using MSYS2 MinGW-w64, in the simplest way, like how Qt Does it, I am strugglinng trying to enable visual styles in mingw-w64, i just cant find a way

Windows development | Windows API - Win32
Developer technologies | C++
Developer technologies | C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
0 comments No comments
{count} votes

Answer accepted by question author
  1. Castorix31 91,501 Reputation points
    2024-02-12T22:47:01.5333333+00:00

    Either with a Manifest as explained at https://learn.microsoft.com/en-us/windows/win32/controls/cookbook-overview or by code with

    CreateActCtx/ActivateActCtx

    By code (tested on Windows 10), at beginning, before any window is created :

    	ULONG_PTR ul;
    	HANDLE hActCtx = CreateAndActivateContext(&ul);
    

    with :

    HANDLE CreateAndActivateContext(ULONG_PTR* pul)
    {
    	HANDLE hActCtx = NULL;
    	ACTCTX act = { 0 };
    	TCHAR szPath[MAX_PATH];
    	HINSTANCE hInstance = LoadLibrary(L"SHLWAPI.DLL");
    	GetModuleFileName(hInstance, szPath, ARRAYSIZE(szPath));
    	act.cbSize = sizeof(act);
    	act.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID;
    	act.lpResourceName = MAKEINTRESOURCE(123);
    	act.lpSource = szPath;
    	hActCtx = CreateActCtx(&act);
    	if (hActCtx != INVALID_HANDLE_VALUE)
    		ActivateActCtx(hActCtx, pul);
    	return hActCtx;
    }
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.