Enable XP visuals in Visual Studio 2008

Hi Experts

Can anyone please explain to me how i can enable XP visuals in Visual Studio 2008.
i am writing a GUI application using the resource editor and WinAPI.
i have been trying to solve this for a while now and have run out of ideas. i have the manifest file created the code is below, but i'm not sure if i am adding it to my application correctly.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?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="X86"
    name="Technoheadz.RipRage.LineBeam"
    type="win32
/>
<description>LineBeam - XP Visuals</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
    type="win32"
    name="Microsoft.Windows.Common-Controls"
    version="6.0.0.0"
    processorArchitecture="X86"
    publicKeyToken="6595b64144ccf1df"
    language="*"
/>
</dependentAssembly>
</dependency>
</assembly> 


here is some simple code which i am playing with. if i add the manifest CreateDialog() fails. but if i disable the manifest everything works fine.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <windows.h>
#include <tchar.h>
#include <stdio.h>

#include "resource.h"



BOOL CALLBACK MainDlgProc (HWND, UINT, WPARAM, LPARAM);

static TCHAR AppName[] = _T ("LineBeam");
HINSTANCE hInst;
HWND MainDlg;

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
	MSG msg;

	hInst = hInstance;



	MainDlg = CreateDialog (hInst,
				MAKEINTRESOURCE (ID_MainDlg),
				0,
				MainDlgProc);

	if (!MainDlg)
	{
		MessageBox (NULL, _T ("Error!"), AppName, MB_ICONERROR);
                return 1;
	}

	ShowWindow (MainDlg, nShowCmd);
	UpdateWindow (MainDlg);

	while (GetMessage (&msg, NULL, 0, 0) > 0)
	{
		if (!IsDialogMessage (MainDlg, &msg))
		{
			TranslateMessage (&msg);
			DispatchMessage (&msg);
		}
	}

	return msg.wParam;
}

BOOL CALLBACK MainDlgProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
	switch (Message)
	{
	case WM_COMMAND:

		switch (LOWORD (wParam))
		{
		case IDOK:
			MessageBox (hwnd, _T ("Hello there!"), AppName, MB_OK);
			return TRUE;
			
		case IDQUIT:
			PostQuitMessage (0);
			return TRUE;
		}
	}

	return FALSE;
}


Please help...
Somewhere in your project (i think by default targetver.h) you have defined

WINVER
_WIN32_WINNT
_WIN32_WINDOWS


reset them to XP. look at this http://msdn.microsoft.com/en-us/library/aa383745%28VS.85%29.aspx
Define them all to 0x501
1
2
3
#define WINVER 0x0501
#define _WIN32_WINNT  0x0501
#define _WIN32_WINDOWS 0x0501 

Ok thank you for your replys, I will Include that, and the manifest above, when I get home. Post results shortly.

Many thanks
No unfortuatley that didn't make any difference. Any other ideas on what it may be?
Given your code, here's how I did it. http://www.mediafire.com/?yr9srtb5y9s4c2g

Open and study the project and post if you have questions, good luck :)
please make a project for me too, with this code:

1
2
3
4
5
6
7
8
#include <windows.h>
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow)
{
     MessageBox (NULL, TEXT ("Hello, Windows XP!"), TEXT ("HelloMsg"), 0) ;
     return 0 ;
}
 
Not much change really, just change the source code of main.cpp to

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#define _WIN32_IE 0x0400


#include <windows.h>
#include <commctrl.h>
#include <tchar.h>
#include "resource.h"


int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
    INITCOMMONCONTROLSEX iccx;
    iccx.dwSize=sizeof(INITCOMMONCONTROLSEX);
    iccx.dwICC=ICC_ANIMATE_CLASS;
    InitCommonControlsEx(&iccx);
    
    MessageBox (NULL, TEXT("Hello, Windows XP!"), TEXT("HelloMsg"), 0);
    return 0;
}

Notice lines 12-15 :)
blackcoder41, I do not know how to use manifest file. I want to know how I can use manifest file. Can you please explain to me how I can use manifest file? If I use this code, it enables XP visuals.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
//#define _WIN32_IE 0x0400


#include <windows.h>
#include <commctrl.h>
#include <tchar.h>
//#include "resource.h"


int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
    INITCOMMONCONTROLSEX iccx;
    iccx.dwSize=sizeof(INITCOMMONCONTROLSEX);
    iccx.dwICC=ICC_ANIMATE_CLASS;
    InitCommonControlsEx(&iccx); 
    
    MessageBox (NULL, TEXT("Hello, Windows XP!"), TEXT("HelloMsg"), 0);
    return 0;
}


This is the directory structure of the project folder.
……………………………………………………………………………………..
HelloMsg3\
Files:
HelloMsg3.ncb, HelloMsg3.sln.
Folders:
Debug, HelloMsg3.
…………………………………………………………………………………………………….......
HelloMsg3\Debug\
Files:
HelloMsg3.exe, HelloMsg3.ilk, HelloMsg3.pdb.
…………………………………………………………………………………………………………………….
HelloMsg3\HelloMsg3\
Files:
HelloMsg3.cpp, HelloMsg3.vcproj, HelloMsg3.vcproj.ADNAN.Adnan2.user.
Folders:
Debug.
…………………………………………………………………………………………………………………………
HelloMsg3\HelloMsg3\Debug
Files:
HelloMsg3.exe.intermediate.manifest, BuldLog.htm, HelloMsg3.obj, mt.dep, vc90.idb, vc90.pdb.
…………………………………………………………………………………………………………………………………
Should I modify HelloMsg3.exe.intermediate.manifest file? If not, then in which folder I should copy manifest file and how to use it? I'm using Visual C++ 2008 Express Edition.
...............................................................................................................................
_Adnan_
Hey sorry for late reply, maybe you've already make it to work.

Adnan2 wrote:
Should I modify HelloMsg3.exe.intermediate.manifest file? If not, then in which folder I should copy manifest file and how to use it? I'm using Visual C++ 2008 Express Edition.
Actually there are many approaches to use the manifest file

Here take look at this much simple approach I made
http://www.mediafire.com/?tvuqb681w9n0vd4

Basically make a project then go to, Project Properties -> Configuration Properties -> Manifest Tool -> Input and Output, then in the Additional Manifest Files add the XPLook.manifest file.

Tell me if that works for you. Good luck! :)
Thanks blackcoder41. It worked for me. Thanks a lot.

_Adnan_
Last edited on
Topic archived. No new replies allowed.