0

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

Attachments Knipsel.JPG 22.09 KB Knipsel2.JPG 24.97 KB
3
Contributors
8
Replies
9
Views
6 Years
Discussion Span
Last Post by hiddepolen
0

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

0

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.

0

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?

0

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

0

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;
}
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

Attachments Knipsel3.JPG 32.89 KB
0

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...

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.