Hi guys,

I have a little question. When I make a dialog in Visual C++ 2010, with the Dialog Editor, you can Drag and Drop buttons, Edits etc. I can also test my dialog. The buttons and edits look very nice, the Windows 7 style. However, when I compile my progam, the nice part disappears, and the buttons and edits change to Windows 97 (or whatever) style. I've posted a picture.
Is there any way to change that?

Thanks in advance!

Cheers,
Hidde

Recommended Answers

All 8 Replies

Check this is in your main()

// Enabling Windows XP visual effects before any controls are created
	Application::EnableVisualStyles();
	Application::SetCompatibleTextRenderingDefault(false);

I'm using 2008 and this is inserted automaticly when you create a new project.
Maybe not so for 2010??

Milton

Thanks for your reply, I'll try this when I'm at home.

I think the problem is that I created a blank project, so no default files or headers.
I'll try that as well.

OK, I've tried it. No joy...

My error messages:

1>c:\users\administrator\documents\c++\temp\temp\temp.cpp(22): error C2653: 'Application' : is not a class or namespace name
1>c:\users\administrator\documents\c++\temp\temp\temp.cpp(22): error C3861: 'EnableVisualStyles': identifier not found
1>c:\users\administrator\documents\c++\temp\temp\temp.cpp(23): error C2653: 'Application' : is not a class or namespace name
1>c:\users\administrator\documents\c++\temp\temp\temp.cpp(23): error C3861: 'SetCompatibleTextRenderingDefault': identifier not found

I've also tried making a default project (Win32 Program), and there is a lot of code, but not anything like your code, or anything resembling Visual Styles...

Any other ideas?

Bump!

You should try what Milton said. Application object can be found in System.Windows.Forms namespace.

If you a using a CLR Windows Forms Application you sould have a "YourProjetName".cpp file that resembles this.

// HEXView.cpp : main project file.

#include "stdafx.h"
#include "Form1.h"

using namespace HEXView;

[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
	// Enabling Windows XP visual effects before any controls are created
	Application::EnableVisualStyles();
	Application::SetCompatibleTextRenderingDefault(false); 

	// Create the main window and run it
	Application::Run(gcnew Form1());
	return 0;
}

I dont get it anymore, namespaces never work out with me...
(See image)

Error Messages:

c:\users\administrator\documents\visual studio 2010\projects\rekenmachine\rekenmachine\winmain.cpp(8): fatal error C1190: managed targeted code requires a '/clr' option

Thanks for all your replies!

I am not using a CLR Windows Forms Application. I don't know what that is...
All I know is that I am making a project, in Visual C++ 2010, everything works, but not the nice Windows 7 button/edit styles.
I thought this wouldbe easier...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.