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 API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,749 questions
C++
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.
3,894 questions
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 88,061 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 Answers by the question author, which helps users to know the answer solved the author's problem.