News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

about xp visual style

Started by gnewz10, June 13, 2006, 04:43:26 AM

Previous topic - Next topic

gnewz10

gud day,

how can i implement xp visual styles in assembly language... thanks. i will highly appreciate any help.... :bg

Ehtyar

There are two ways to accomplish this, but both are quite similar. For an application for which you do not have the source, and can't be arsed modifying the resources, create a file in the directory of the executable called my.exe.manifest, substituting the "my" for the name of your executable, and fill it with the following xml.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0"
processorArchitecture="X86"
name="my.exe"
type="win32" />
<description>my executable</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>

IMPORTANT: Be sure to modify the values in the FIRST assemblyIdentity and Descriptions tags appropriately.
Once you have done that, run your executable, and it should take on the current windows theme.
NOTE: Some apps do respond negatively to this techniqe, microsoft excel for example. You have been warned.

If you do indeed have the source, and are able to compile the program, create the manifest as specified above, then open your resource file and add the following line.
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "my.exe.manifest"
again, substituting the "my" with the name of the executable. Once that step is complete, compile the program, and it should take on the current XP visual style.

Mark Jones

"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

jdoe

Quote from: Mark Jones on June 13, 2006, 04:39:31 PM
Ehtyar, you forgot to link to ComCtl32.lib and call to InitCommonControls. Re:
http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/userex/cookbook.asp?frame=true#no_extensions

Mark, it's not always needed. For basic controls like buttons, editboxes or comboboxes it is in most case not needed and a manifest as a resource could be enough.


Ehtyar

jdoe is correct, so long as you're not actually using any common controls, you need not link to it.

kyo

manifest is good  :U but can we use custom themes like yahoo messanger  ::)

Ehtyar

afaik that requires either custom coding for the skin, or implementing a custom windows style for parent/child windows of your application, neither of which i can help you with, sorry.

Shantanu Gadgil

With respect to "not needing" a call to InitCommonControls:
MSDN does say that if we are including the XML as a  resource, an InitCommonControls() is not required, but what I have seen is that if the "Themes" service is OFF, the program will not start.

Put a call to InitCommonControls, and the same program will work fine.

Just a note, hope it helps!  :bg

Regards,
Shantanu
To ret is human, to jmp divine!

Jimg

If the information in this thread http://www.masm32.com/board/index.php?topic=3408.0, initcommoncontrols doesn't have to be actually executed, just assembled somewhere.

Shantanu Gadgil

Yep!  :U :U Confirmed that.
The "call" to InitCommonControls need not be _actually_ executed, just put there to ensure the library is _definitely_ loaded !!!

Thanks for the info!

Regards,
Shantanu
To ret is human, to jmp divine!

MichaelW

At least under Windows 2000 InitCommonControlsEx works the same, but I suspect that there is some hidden difference, perhaps a longer load time if the function is not actually called.

MSDN: InitCommonControlsEx.
eschew obfuscation

Tam

but why in visual basic 6, we always need to call the InitCommonControls function, although we don't use the common controls?

thank you!

TNick

I see this matter was in discussion here so I decided not to open a new thread. Here is my problem: I made a manifest as specified in same path as my exe. The XP style is there, happily. Then, I've added the manifest as a resource:
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "MyApp.exe.manifest"

I do not get any warnings / error messages while assembling / linking, but, if I remove the manifest from that path or, for that matter, if I move the exe, the XP style is gone. I have some Icons and RCDATA in resource section, if this matters.

Does anyone knows what the problem is? Maybe someone had same problem?
Thanks!
Nick


ramguru

I think the problem is ID (CREATEPROCESS_MANIFEST_RESOURCE_ID) it should be 1

TNick

CREATEPROCESS_MANIFEST_RESOURCE_ID is 1 according to windows.inc. And changing it to 1 has same result.

Thanks anyway, ramguru!

Nick