Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General / November 2004



Tip: Looking for answers? Try searching our database.

XP-Style Theme

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DavidM - 28 Nov 2004 20:18 GMT
I have a VB6 application that I would like to create an XP-style theme.  It
is my understanding that I have to create a manifest file and include with
my application, along with calling some API call.

Can someone give me instructions on how to accomplish this.

Also, is there a way to include the manefest file within my project without
having to include a standalone file?  Can I incorporate it within my
compiled EXE somehow?

Thanks
Peter Young - 28 Nov 2004 22:34 GMT
> I have a VB6 application that I would like to create an XP-style theme.  It
> is my understanding that I have to create a manifest file and include with
> my application, along with calling some API call.
>
> Can someone give me instructions on how to accomplish this.

http://www.vbaccelerator.com/home/VB/Code/Libraries/XP_Visual_Styles/index.asp

> Also, is there a way to include the manefest file within my project without
> having to include a standalone file?  Can I incorporate it within my
> compiled EXE somehow?

http://www.vbadvance.com
DavidM - 29 Nov 2004 00:58 GMT
Thanks for the links.

This brings up another related question -- what is a resource file in VB and
what are they used for?

What kind of information can I put into them?

What are the advantages and disadvantages of using them?

How can I go about creating a Resource file myself -- none of my VB books
even mention what they are or how to use them.

Is there any online help explaining Resource files?

>> I have a VB6 application that I would like to create an XP-style theme.
>> It
[quoted text clipped - 12 lines]
>
> http://www.vbadvance.com
Mark Alexander Bertenshaw - 29 Nov 2004 06:48 GMT
> Thanks for the links.
>
[quoted text clipped - 9 lines]
>
> Is there any online help explaining Resource files?

A resource file is nothing to do with VB - it is simply a container for a
number of resources.  Resources are blocks of data which can be embedded
into an executable file.  Each resource has a type and a number e.g.
Bitmap - 101 .  There are standard resource types, and private resource
types (which can contain any types of data).  Windows knows how to deal with
standard types of resources e.g. Bitmaps and Menus.  VB has built-in
functions for pictures e.g. LoadResPicture(), strings LoadResString(), and
all other types as byte arrays LoadResData().

Advantages of using resources are that there are standard ways of load data
from executeable files (which means that you could embed BMP files which
would normally be put in a Pictures folder, for instance).  When you compile
bitmaps into VB embedded in standard controls, the bitmaps are "hidden" in
the executeable.  If you instead put the bitmaps into resources, any of your
applications would be able to read the bitmaps from the executeable.  This
could be a good and a bad thing.  :-)
They are also very helpful if you want to have internationalised
applications, since you can add multiple resources for a single resource ID,
each one for a different target language, and the resource function will
load the appropriate one (although there are better ways to do this).

If you have VB6, there is a Resource file Add-In which comes with the
standard installation.  With VB5 you had to download it (and I wouldn't be
surprised if you can't any more).

As for online help - it does exist.  However, I recommend you go and read up
in depth on this topic in MSDN.

--
Mark Bertenshaw
Kingston upon Thames
UK
DavidM - 30 Nov 2004 03:33 GMT
Regarding this thread.... I attempted to create an
applicationname.exe.manifest file and placed it within my VB6 project
directory.  I noticed that even though I was not calling the
InitCommonControl routines... when I compiled my VB6 applicatin to EXE, it
would return an "Out of Memory" or "Object or With Statement used..." within
my main routine in my module.

Running the applicaton within Debug mode in IDE worked fine.

I then renamed the manifeset filename to .bak and recompiled... and all
worked fine again.

I guess the COMCTL32.DLL V6 still looks for manifest files whether I call
functions or not???

Also, I tried added the InitCommonControl within my forms initialize routine
and recompiled... I did not see any XP-style theme when I launched the
application.  Now I did not change the manifest file from the default... so
all old application names, etc., is the same.  Anyone have any ideas why the
call appeared to work but nothing was noticable on screen?

>> Thanks for the links.
>>
[quoted text clipped - 48 lines]
> Kingston upon Thames
> UK
Peter Young - 30 Nov 2004 04:02 GMT
> Also, I tried added the InitCommonControl within my forms initialize routine
> and recompiled... I did not see any XP-style theme when I launched the
> application.  Now I did not change the manifest file from the default... so
> all old application names, etc., is the same.  Anyone have any ideas why the
> call appeared to work but nothing was noticable on screen?

All you need is the manifest (either as an external file or an embedded resource) and the call to InitCommonControls.
Are you running it on XP?
DavidM - 30 Nov 2004 14:57 GMT
Yes --

>> Also, I tried added the InitCommonControl within my forms initialize
>> routine
[quoted text clipped - 8 lines]
> resource) and the call to InitCommonControls.
> Are you running it on XP?
Peter Young - 30 Nov 2004 18:00 GMT
> >> Also, I tried added the InitCommonControl within my forms initialize
> >> routine
[quoted text clipped - 9 lines]
> > Are you running it on XP?
> Yes --

Both vbAccelerator.com and vbAdvance.com provide VB projects that demonstrate how to do this. Do those render correctly
for you?
Randy Birch - 30 Nov 2004 23:47 GMT
Under XP, if there is a manifest with the same name as the exe, Windows
attempts to use it. If the application does not call InitCommonControls, and
does not have any VB5 common controls on the form (which also call
InitCommonControls), the exe will fail in any number of manners, none
pretty. Comctl32.dll has nothing to do with the use of the manifest -- it is
provided to inform Windows that Windows should use the Version 6 features of
the common control dll.

And to see the XP-styled 'themes' applied to the common controls, you must
be using the VB5 controls, not the VB6 ones. The VB5 controls use
comctl32.dll; the VB6 ones do not.

Finally, successfully applying the themes with InitCommonControls and a
manifest will not result in forms taking on a themed appearance, as with
Office 2003 under XP. That requires additional magic far exceeding a simple
api call.

Signature

Randy Birch
MS MVP Visual Basic
http://vbnet.mvps.org/

: Regarding this thread.... I attempted to create an
: applicationname.exe.manifest file and placed it within my VB6 project
[quoted text clipped - 69 lines]
: > Kingston upon Thames
: > UK
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.