Windows application manifests

Mehrdad wfunction at hotmail.com
Tue May 15 20:44:49 PDT 2012


On Tuesday, 15 May 2012 at 14:03:47 UTC, Gor Gyolchanyan wrote:
> Can anyone, please, tell me what these manifests are, where do 
> they fit in my application binaries, why is one needed to get 
> the pretty windows 7 buttons and how to use them with DMD?

Just FYI, you don't actually *need* to include manifests in your 
executable, if you know another DLL already has them.

Here's a hack to show what I mean, for enabling visual styles:

void enableVisualStyles()
{
	TCHAR[MAX_PATH] dir;
	dir[GetSystemDirectory(dir.ptr, dir.length)] = '\0';
	enum
	{
		ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID = 0x00000004,
		ACTCTX_FLAG_RESOURCE_NAME_VALID = 0x00000008,
		ACTCTX_FLAG_SET_PROCESS_DEFAULT = 0x00000010,
	}
	auto actCtx = ACTCTX(ACTCTX.sizeof,
		ACTCTX_FLAG_RESOURCE_NAME_VALID	|
		ACTCTX_FLAG_SET_PROCESS_DEFAULT	|
		ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID,
		"shell32.dll", PROCESSOR_ARCHITECTURE_INTEL,
		0, dir.ptr, MAKEINTRESOURCE(124), null, null);
	auto hActCtx = CreateActCtx(actCtx);
	assert(hActCtx != INVALID_HANDLE_VALUE);
	ULONG_PTR ulpActivationCookie;
	BOOL success = ActivateActCtx(hActCtx, ulpActivationCookie);
	assert(success);
}

Basically, since shell32.dll already has our manifest, I can just 
call this function instead. :-)


More information about the Digitalmars-d mailing list