?
Solved

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

Posted on 2005-03-23
10
Medium Priority
?
212 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month10 days, 11 hours left to enroll

765 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