Enabling Win32 Based Programs To Use Visual Styles [C++]

Forum rules
- Ask questions about or share code from languages other than Source Engine scripting.
- Start new topic titles with the code language in brackets (i.e. [C#], [C++], [PHP], etc.)
User avatar
Motherfat
100+ Posts
100+ Posts
Posts: 127
Joined: Thu Jul 22, 2010 2:29 pm
Location: Ontario, Canada

Enabling Win32 Based Programs To Use Visual Styles [C++]

Post by Motherfat »

This is a step by step easy way to enable it from the gay old win98 style to modern visual styles other then looking on microsoft site.
First Make An XML Document and add text shown below and save it in your <ProjectFolder>\<ProjectNameFolder> as <YourAppname>.exe.manifest

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
    version="1.0.0.0"
    processorArchitecture="*"
    name="CompanyName.ProductName.YourApplication"
    type="win32"/>
<description>Your application description here.</description>
<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="*"
            publicKeyToken="6595b64144ccf1df"
            language="*"/>

    </dependentAssembly>
</dependency>
</assembly>
Change the stuff that it says to, then right click on your project name and click Add > Existing Item... and select <YourAppName>.exe.manifest then click ok. Then click on the project in solution explorer then click properties > Configuration Options > Linker > Command Line then in the box and add comctl32.lib then in your main source code at the top part where other includes are add #include <CommCtrl.h> then Call InitCommonControls Here As Shown

Code: Select all

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;
	HFONT basefont;
	InitCommonControls();

	switch (message)
	{
	case WM_CREATE:
	{
then in your resource file .rc at the end of the file add

Code: Select all

CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "<YourAppname>.exe.manifest"
Cabal Shall Rise Again
Image
Image