Thread overview
How do I enable visual styles?
Jan 18
Jack
Jan 18
Jack
Feb 19
Jack
January 18
Currently I'm using dmd but the release binaries I'll be usind ldc. Is this how I can enable visual styles on dmd? and how is this done on ldc?

pragma(linkerDirective, "\"/manifestdependency:type='win32' " ~
				"name='Microsoft.Windows.Common-Controls' version='6.0.0.0'" ~
				"processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"");
January 18
I haven't played with the pragma yet but I've done it before both with the file.exe.manifest XML file sitting alongside it and with the resource compiler before (you can use the same resource compilers for D as you use for C btw)
January 18
On Monday, 18 January 2021 at 19:50:18 UTC, Adam D. Ruppe wrote:
> I haven't played with the pragma yet but I've done it before both with the file.exe.manifest XML file sitting alongside it and with the resource compiler before (you can use the same resource compilers for D as you use for C btw)

I have done that before with the XML manifest file but now I'd to do it without that external dependence, now I'm trying with the linker, if possible. It seems  SetWindowTheme(hwnd, L"Explorer", NULL) do the same, I'm researching into that
February 19
if someone happens to be looking to do that in the future: I didn't find a way to do this with a linker but managed to find a way to do this with code only. The code goes like this:

// source: https://stackoverflow.com/a/10444161/800123
#include <windows.h>

// NOTE: It is recommended that you delay-load ComCtl32.dll (/DelayLoad:ComCtl32.dll)
// and that you ensure this code runs before GUI components are loaded.
// Otherwise, you may get weird issues, like black backgrounds in icons in image lists.
ULONG_PTR EnableVisualStyles(VOID)
{
    TCHAR dir[MAX_PATH];
    ULONG_PTR ulpActivationCookie = FALSE;
    ACTCTX actCtx =
    {
        sizeof(actCtx),
        ACTCTX_FLAG_RESOURCE_NAME_VALID
            | ACTCTX_FLAG_SET_PROCESS_DEFAULT
            | ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID,
        TEXT("shell32.dll"), 0, 0, dir, (LPCTSTR)124
    };
    UINT cch = GetSystemDirectory(dir, sizeof(dir) / sizeof(*dir));
    if (cch >= sizeof(dir) / sizeof(*dir)) { return FALSE; /*shouldn't happen*/ }
    dir[cch] = TEXT('\0');
    ActivateActCtx(CreateActCtx(&actCtx), &ulpActivationCookie);
    return ulpActivationCookie;
}

it's C as code but can be translated to D easy.