MSFN Forum: [vb] Give Your App The XP Theme - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[vb] Give Your App The XP Theme Rate Topic: -----

#1 User is offline   Doggie 

  • I'm very inactive :(
  • Group: Patrons
  • Posts: 2,676
  • Joined: 13-October 02

Posted 30 March 2003 - 06:43 AM

Ever seen how programs designed for XP can have the xp theme that u have currently running?
Well due to the fact VB6 wasn't designed for making XP programs (due to the fact it was for 95/98 at the time).
So heres how it can be done two ways

First Way: Exe.Manifest

This is the easier way of making themes to work on your program.

For this example.. put a command button or two on the new project exe you started

place the follow declarations in:
Option Explicit
Private Declare Function InitCommonControls Lib "comctl32.dll" () As Long

This is declaring function for xp themes
Now to ensure this works, we need to make the program enable this by putting in code in the Form_Initialize event
Private Sub Form_Initialize()
    InitCommonControls
End Sub

And for the command button click event put:
Private Sub Command1_Click()
    Unload Me
End Sub


Ok now you can't see anything new if u run it in the IDE(intergrated development enviroment) so compile an exe to the desktop. Now if u run it it won't work.. why u say. because we haven't made the manifest file.

Simply open up notepad and input the following lines:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" processorArchitecture="*" version="6.0.0.0" name="mash"/>
<description>Enter your Description Here</description>
<dependency>
   <dependentAssembly>
      <assemblyIdentity
           type="win32"
           name="Microsoft.Windows.Common-Controls" version="6.0.0.0"
           language="*"
           processorArchitecture="*"
         publicKeyToken="6595b64144ccf1df"
      />
   </dependentAssembly>
</dependency>
</assembly>

Save this file in the same directory as the exe and call it yourprogramname.exe.manifest
Now run and u'll find it will have taken the XP theme
Questions, comments etc are welcome :)


#2 User is offline   xpguy 

  • Group: Members
  • Posts: 7
  • Joined: 12-July 02

Posted 04 April 2003 - 05:12 AM

is that the same to what ms did with the office 2003 and wont that mean only windows xp can use the program?

#3 User is offline   MSNwar 

  • Its Time ...
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,215
  • Joined: 23-December 01

Posted 04 April 2003 - 05:16 AM

Nice one Doggie.

#4 User is offline   Doggie 

  • I'm very inactive :(
  • Group: Patrons
  • Posts: 2,676
  • Joined: 13-October 02

Posted 07 April 2003 - 03:21 AM

xpguy said:

is that the same to what ms did with the office 2003 and wont that mean only windows xp can use the program? 
i don't understand the first question.. but the xp theme added to program doesn't mean it can't be used on other windows os's.. all it does is if the os happens to be XP, it will allow to take the current theme on the program.. so it automatically skins it as such..

#5 User is offline   Liam 

  • Group: Members
  • Posts: 1
  • Joined: 09-April 03

Posted 09 April 2003 - 02:57 AM

I just use the .exe.manifest without putting in the API Declare and it works :)

#6 User is offline   Doggie 

  • I'm very inactive :(
  • Group: Patrons
  • Posts: 2,676
  • Joined: 13-October 02

Posted 09 April 2003 - 06:19 AM

lol yes u told me before :)

#7 User is offline   brian 

  • Junior
  • Pip
  • Group: Members
  • Posts: 51
  • Joined: 17-December 03

Posted 07 January 2004 - 01:55 AM

Listview headers and other components do not get theme look, just command button. Any way to make all the components work or maybe just a few more?

#8 User is offline   magicfly 

  • << I live in the 80's >>
  • PipPipPipPip
  • Group: Members
  • Posts: 507
  • Joined: 14-June 03

Posted 07 January 2004 - 03:40 AM

great doggie!!
very very nice, it works! :)
bye

#9 User is offline   Doggie 

  • I'm very inactive :(
  • Group: Patrons
  • Posts: 2,676
  • Joined: 13-October 02

Posted 07 January 2004 - 04:28 AM

brian, on Jan 7 2004, 06:55 PM, said:

Listview headers and other components do not get theme look, just command button.  Any way to make all the components work or maybe just a few more?

depends what version of Microsoft Control u use.. version 5 is usually the one that has all of the controls themed..

#10 User is offline   fwm 

  • Newbie
  • Group: Members
  • Posts: 36
  • Joined: 28-July 03

Posted 09 January 2004 - 12:16 PM

I can recommend that you embed the manifest file as a resource to your project, so it gets build inside the exe. Then you wont have to have a manifest file in your app folder.
My experince is that it also gives less problems.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy