I don't like NET, how can I use Visual Styles in win32 program?

Hi, I learned Win32 Programming from here:
http://zetcode.com/tutorials/winapi/

but unfortunately as you can see the view isn't lovley.
so I tried to find what's in the Net's code makes the view so lovley.
Well, finally I found that the function is
Application::EnableVisualStyles();
When I deleted it the program it looked just like a pure Win32 C++ Code that I use in my programs.
the problem is that I can't look at the code of the function, and I searched in google many ways, themes ... I found this and I don't understand how do I use this method:
http://msdn.microsoft.com/en-us/library/dd373487(v=vs.85).aspx

So if you have the Source code of the function to u can explain me other method or like the method I found Please help me!!
TNX...

(Sorry about my english...)
If you are using Visual Studio 2010, you could add this in stafx.h:L
1
2
3
4
5
6
7
8
9
10
11
// enable XP themes
#define ISOLATION_AWARE_ENABLED 1
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif 




If you are not, must follow the hard way to call InitCommonControlsEx() and create manifest file manually.
Oh mann I'm using VC2008...
99% the code posted will work in VS2008 too. It was posted in MSDN forums before even vs2008 came out.

I think following defines must be added first too:
1
2
3
#define _WIN32_WINNT 0x0502
#define _WIN32_IE 0x0600
#define _WINVER 0x0502 
Last edited on
I love youuu guysssss!!!!!!!!!!
Your'e the Best!!!!!! I can't beleive it, everyone told me that there's no reason to try to create window applications without NET, and now I can create normal applications with a pure C++ code. Finally!!!
TNX TNX TNX!

Ohh just one more thing: the text looks pretty bad (it does'nt have visual style), how can I fix it?
Last edited on
How can I change the font of the window's text's?
@ OP: Is 2010 not a valid option for some reason?: http://www.microsoft.com/visualstudio/en-us/products/2010-editions

Font is normally a system wide user preference, where is it that you don't think it looks right?
Ohh now I found my answer, I wanted to set the font myself...
the code I was looking for is:
1
2
3
4
HFONT font=CreateFont(-15,0,0,0,FW_NORMAL,0,0,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FF_DONTCARE,"Times New Roman");
....
butt = CreateWindow(..);
SendMessage(butt,WM_SETFONT,(WPARAM)font,MAKELPARAM(true,0));


Just one more question: what is the deafult NET's font?
Last edited on
Topic archived. No new replies allowed.