Continuing the DirectUI XML we come across a fiew road blocks. Mainly because it’s not documented. However with extensive testing you’re sure to find out a lot. The biggest concern over Ave and I’s mind is the themeable() function. We knew it take two parameters, but we didn’t know what the second one was for.
Last night we discussed it and couldn’t figure out what it was used for. So time goes on, and I stay up late to continue finding what it’s for. It wasn’t until this afternoon that we cracked it. After all this time we found out it was for the Classic theme. Doesn’t make sence at first but I can explain.
This example will be used for the rest of the blog entry: themeable(x, y)
If you look back at my recent post I made a mod for ExplorerFrame.dll to allow custom colors on hover, compressed, etc. When I had it set it just a theme property (x) any theme applied that didn’t have those properties caused Windows Explorer to not work. My hacky solution to that was to just create a StyleHack and add those properties to every theme including the default Aero. It became hard to do that when I went to test a theme and it was in use so it applied Aero (which at the time didn’t have the properties) so I was stuck. The only way I could get out was to go into the registry, change the applied theme, log out and then log back in. Not the most convenient thing right? Well luckily today’s research fixed that.
If you’ve ever looked closely at a property that specifies themeable() you’ll probably notice that “x” usually (sometimes it has both hard”coded” values) has a property that reads from the theme while “y” is something that’s hard”coded”. (eg. window, argb(0,0,0,0), etc). If “x” isn’t available for whatever reason then “y” will be used. Another example I’m about to show you is from my ExplorerFrame mod. In this screen below I have the old ExplorerFrame mod (left) and the default ExplorerFrame 40690.xml (right).
http://www.tehupload.com/uploads/486360dbcab3329old.png
Look at lines 1203 and 1213 of the default (right). You can see it specified a color. One being pre-defined, the other being specific. Now look at those lines on the modified file (left). As you can see it reads from the MSStyles. Now what happens when the MSStyles (if one is applied) doesn’t have that property? Explorer doesn’t know what to do so it just stops working. Now look at this next image.
http://www.tehupload.com/uploads/552260dbcab3322new.png
On the modified document (left) it now has themeable(x, y). Now when an MSStyles file (if one is applied) is missing the property or if you’re using classic it will default to “y”.
Now that that’s cleared up you’re probably still wondering “If it’s used for classic then why is it in the theme’s shellstyle.dll”. Good question. Now here’s an answer. Sometimes a window will force the classic style. (Ex. Open CMD with Basic applied in Vista.) You can also run CMD as an Administrator and run “net stop themes” without the quotations and it’ll show a classic like UI which gives a better viewing of what it does. When either of these two happen you’ll notice that the Classic interface is almost pure white with a light blue titlebar (instead of the default darker blue) and a horrible-looking border padding. This is where those “y” values in a theme’s shellstyle.dll are used.
If you have any thoughts or questions about the themeable() function the feel free to leave a comment.
-Panda