Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Using Windows XP Visual Styles With controls on Windows Form (VS 2003)

Posted on 2005-03-23
10
Medium Priority
?
222 Views
Last Modified: 2011-09-20
Her is my problem,

I'm trying to build a form, so user with Win XP could see with the visual styles of windows xp instead of windows 2000 and before.  I did follow the instruction of this page
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchUsingWindowsXPVisualStylesWithControlsOnWindowsForms.asp.

But when I try to execute the project I always receive the message : Unable to write to outfile file <executable file>.  Is there a manner to do so, and does the VS 2005 already use the visual styles of windows XP?

Thanks,

Chris
0
Comment
Question by:chris_nephew
10 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 13611921
In VS 2003 the following line is enough to add XP style support:

Application.EnableVisualStyles()
0
 
LVL 1

Author Comment

by:chris_nephew
ID: 13612144
Sorry, I have VS 2002!!!  Because I already tried this line, but it seems that enablevisualStyles is'nt a feature in the application module...
0
 
LVL 9

Expert Comment

by:p_sie
ID: 13612542
VS 2005 uses visual styles of XP in the IDE, no worry...
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Author Comment

by:chris_nephew
ID: 13612994
IF I buy the VB.NEt 2003, will I be able to set Application.EnableVisualStyles() to true and it will work?
0
 
LVL 2

Expert Comment

by:stevenbaker
ID: 13613018
yes, although there are some bugs in Application.EnableVisualStyles() so we use a manifest file to sepcify to use the xp styles.
see here:
http://www.hanselman.com/blog/PermaLink.aspx?guid=36187116-fbe3-4959-af04-c0c9e42479a5
0
 
LVL 1

Author Comment

by:chris_nephew
ID: 13613108
So, there is no solution for my initial problem with the VS 2002??
0
 
LVL 2

Accepted Solution

by:
stevenbaker earned 375 total points
ID: 13613444
its not a vs2002 issue, it is a framework version - get the framework v1.1 and it will be available, but will still be buggy (ie when you do form.showDialog) so I would still use a manifest file

the issue is that the controls are drawn by Comctl32
in .net, windows are drawn using version 6, so get themed and curved borders etc
controls (like buttons) use version 5, so look old and dull
to use Comctl32 v6, you need your application to tell windows to use v6 of Comctl32 (if it has it - ie its an xp box)
All application.enableVisualStyles does is make this easier, but it does have some bugs and is a .net 1.1 feature

in short, use .net 1.1 and use enableVisualStyles
if your app starts crashing, use a manifest file
0
 
LVL 1

Author Comment

by:chris_nephew
ID: 13614805
The problem is that I have the .NET framework 1.1 installed, and if I do all the steps that is described by the page mentionned in my initial question, I get the error mentionned in the initial message.  And I don't have the enableVisualStyles applicable in the application.  I don't see the enabledVisualStyles anywhere...

I'm pretty confused
0
 
LVL 2

Assisted Solution

by:stevenbaker
stevenbaker earned 375 total points
ID: 13619937
Can you post your manifest file that you use and causes the "Unable to write to outfile file <executable file>. " exception

an example one to use that works, for an app called MyApp (so in the bin folder we have MyApp.exe) is:

MyApp.exe.manifest

 <?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="Microsoft.Winweb.MyApp"
   type="win32"
/>
<description>Example Application</description>
<dependency>
   <dependentAssembly>
     <assemblyIdentity
       type="win32"
       name="Microsoft.Windows.Common-Controls"
       version="6.0.0.0"
       processorArchitecture="X86"
       publicKeyToken="6595b64144ccf1df"
       language="*"
     />
   </dependentAssembly>
</dependency>
</assembly>

If you add this to your project, changing from MyApp to the name of your application, and copy it to your bin folder all should be ok.
If not, post eactly when you are getting the error
0
 
LVL 1

Author Comment

by:chris_nephew
ID: 13632772
Finally, I bought VB.NET 2003 and my problem was solved, thanks for your support.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Loops Section Overview
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question