The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: anuradha on August 15, 2007, 10:50:21 PM

Title: custom visual styles
Post by: anuradha on August 15, 2007, 10:50:21 PM
hi people
can any one tell me how can I add visual styles to my application???
thankx :bg
Title: Re: custom visual styles
Post by: thomas_remkus on August 16, 2007, 02:47:46 AM
Can you define a little more about what you are needing? Like ... what are you expecting?
Title: Re: custom visual styles
Post by: anuradha on August 18, 2007, 05:01:15 PM
hi
thanks for the replies
i just want to know is their any method that can  add xp visual style to application  that i create s...
sorry for my bad english  :red
thanks
Title: Re: custom visual styles
Post by: evlncrn8 on August 18, 2007, 05:30:44 PM
add a manifest, and make sure you call initcommoncontols..

search for 'manifest' on the forum..
Title: Re: custom visual styles
Post by: MichaelW on August 18, 2007, 09:53:39 PM
To use the XP visual styles you must create an application manifest that specifies which version of ComCtl32.dll should be used. As a minimum you can use the example manifest from here (http://msdn2.microsoft.com/en-us/library/ms649781.aspx). The application-specific data in the manifest is not necessary, so it can be used exactly as shown. The manifest must be stored in a file with the name appname.exe.manifest, where appname is the actual name of the EXE.

The application resource definition should contain:

#define RT_MANIFEST 24
#define CREATEPROCESS_MANIFEST_RESOURCE_ID  1

CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "test.exe.manifest"

By using CREATEPROCESS_MANIFEST_RESOURCE_ID the manifest is included in the executable, eliminating any dependence on the manifest file (although a manifest file placed in the same directory as the EXE can still override the one in the EXE).

The example app in the attachment creates an edit control with the  ES_PASSWORD style (http://msdn2.microsoft.com/en-us/library/ms672063.aspx). Because of this style, each character in the edit control will display as a black circle if the app is using the XP visual styles, or as an asterisk (*) if not.

The code that I started with is a window demo in which I attempted to explain all the major components. Just ignore any unnecessary comments.


[attachment deleted by admin]
Title: Re: custom visual styles
Post by: Timbo on August 19, 2007, 08:35:44 PM
Greetings,

With the latest MS linker you can also do the following:

/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"

Which causes the linker to create and embed the manifest directly with no need for messing with resources.

This is the behavior of the linker supplied with VS2k5.

Regards,

Tim