Thursday, February 25, 2010

Discoveries in Windows Mobile - Part 3

I've found in a russian site the meaning of all those colors I've posted about yesterday.

Here they are:

Color#Description
0 COLOR_ALERT
Obsolete.
1 COLOR_ACCENTTEXT
Obsolete.
2 COLOR_CALOFFHOURS
Obsolete.
3 COLOR_CALONHOURS
Obsolete.
4 COLOR_TODAYTEXT
Today screen text color.
5 COLOR_STARTICONBACKGROUND
Base color for title bar and soft keys
Obs.:Windows Mobile 6 Professional and Windows Mobile 6 Classic.
6 COLOR_TODAYSEPARATOR
Today screen separator line color.
7 COLOR_TODAYMENU
Today screen menubar background color.
8 COLOR_NAVBAR
Color of title bar
Obs.:Windows Mobile 6 Professional and Windows Mobile 6 Classic.
9 COLOR_NAVBARTEXT
Color of title bar text on
Obs.:Windows Mobile 6 Professional and Windows Mobile 6 Classic.
10 COLOR_NAVBARHILITE
Obsolete.
11 COLOR_NOTIFTRAY
Notification tray background color
Obs.:Windows Mobile 6 Professional and Windows Mobile 6 Classic.
12 COLOR_NOTIFTRAYHILITE
Background of highlighted icon in the notification tray
Obs.:Windows Mobile 6 Professional and Windows Mobile 6 Classic.
13 COLOR_BUBBLECAPTION
Left color of bubble caption background gradient on
Obs.:Windows Mobile 6 Professional and Windows Mobile 6 Classic.
14 COLOR_GRADIENTBUBBLECAPTION
Right color of bubble caption background gradient
Obs.:Windows Mobile 6 Professional and Windows Mobile 6 Classic.
15 COLOR_INTGRADLEFT
Left color of a gradient listview background, for the interlaced rows.
16 COLOR_INTGRADRIGHT
Right color of a gradient listview background, for the interlaced rows.
17 COLOR_HIGHGRADLEFT
Currently not used.
18 COLOR_HIGHGRADRIGHT
Currently not used.
19 COLOR_PHONEDIALERTEXT
Text color of the text in the Phone dialpad buttons.
20 COLOR_TRAYGRADLEFT
Base color for title bar and soft keys
Obs.:Windows Mobile 6 Standard only.
21 COLOR_TRAYGRADRIGHT
Right color of tray
Obs.:Windows Mobile 6 Standard only.
22 COLOR_TRAYTEXT
Tray text color
Obs.:Windows Mobile 6 Standard only.
23 COLOR_TRAYBKGND
Tray background color, if not a gradient
Obs.:Windows Mobile 6 Standard only.
24 COLOR_DIALPADBKGND
Currently not used.
25 COLOR_CRITGRADLEFT
Left color of a critical bubble caption gradient
Obs.:Windows Mobile 6 Professional and Windows Mobile 6 Classic.
26 COLOR_CRITGRADRIGHT
Right color of a critical bubble caption gradient
Obs.:Windows Mobile 6 Professional and Windows Mobile 6 Classic.
27 COLOR_BUBBLETITLE
Text color of a bubble caption
Obs.:Windows Mobile 6 Professional and Windows Mobile 6 Classic.
28 COLOR_CRITBUBBLETITLE
Text color of a critical bubble caption
Obs.:Windows Mobile 6 Professional and Windows Mobile 6 Classic.
29 COLOR_ALERTTITLE
Alert title text color. An alert is a full screen message box
Obs.:Windows Mobile 6 Standard only.
30 COLOR_ALERTWINDOW
Background color of a listview in alert. Also used for volume alert slider bar
Obs.:Windows Mobile 6 Standard only.
31 COLOR_ALERTRULE
Color of alert horizontal separator line. An alert is a full screen message box
Obs.:Windows Mobile 6 Standard only.
32 COLOR_HOMETEXT
Home Screen text
Obs.:Windows Mobile 6 Standard only.
33 COLOR_HOMERULE
Home Screen horizontal separator line
Obs.:Windows Mobile 6 Standard only.
34 COLOR_HOMEHIGHLIGHT
Home Screen background color of highlighted text
Obs.:Windows Mobile 6 Standard only.
35 COLOR_HOMEHIGHLIGHTTEXT
Home Screen highlighted text
Obs.:Windows Mobile 6 Standard only.
36 COLOR_GRADLEFT
Left color of a gradient listview background, used to draw alternating lines together with COLOR_INTGRADLEFT and COLOR_INTGRADRIGHT.
37 COLOR_GRADRIGHT
Right color of a gradient listview background, used to draw alternating lines together with COLOR_INTGRADLEFT and COLOR_INTGRADRIGHT.
38 COLOR_STARTMENU
Start Menu background color when there is no background bitmap
Obs.:Windows Mobile 6 Professional and Windows Mobile 6 Classic.
39 COLOR_STARTMENUTEXT
Start Menu text.
40 COLOR_TAPANDHOLD
Tap and Hold
Obs.:Windows Mobile 6 Professional and Windows Mobile 6 Classic.

Wednesday, February 24, 2010

Discoveries in Windows Mobile - Part 2

After removing every possible color information from the WM65, I started adding some color to see what affected what.

The first element I tried was placing back the SHColor value in the [HKEY_LOCAL_MACHINE\Software\Microsoft\Color] registry key.

I didn't have enough time today to play with the colors, so I simply put back the default base color from WM65, which are:


FF,00,00,00,00,00,00,00,DD,DD,DD,00,FF,FF,CC,00,FF,FF,FF,00,82,82,82,00,
82,82,82,00,DE,DE,DE,00,74,74,74,00,FF,FF,FF,00,74,74,74,00,74,74,74,00,
74,74,74,00,82,82,82,00,74,74,74,00,FF,FF,FF,00,DE,DE,DE,00,9D,9D,9D,00,
9D,9D,9D,00,FF,FF,FF,00,82,82,82,00,74,74,74,00,FF,FF,FF,00,82,82,82,00,
84,84,C3,00,82,82,82,00,74,74,74,00,FF,FF,FF,00,FF,FF,FF,00,00,00,00,00,
FF,FF,FF,00,00,00,00,00,FF,FF,FF,00,82,82,82,00,9D,9D,9D,00,FF,FF,FF,00,
FF,FF,FF,00,DE,DE,DE,00,74,74,74,00,FF,FF,FF,00,74,74,74,00

Which represents the following colors:


Every four bytes represents a specific color in the table above.

After I add this registry entry, WM65 has this appearance:



Let's see if I can identify each color tomorrow.

Tuesday, February 23, 2010

Discoveries in Windows Mobile

Currently I'm in the developing a new personal project a Theme Creator for Windows Mobile. Yes I know there are a lot out there, but I'm doing this more because the fun of it rather than the product itself. And in the mean time, trying to discover a few things in the Windows Mobile platform.

But on with the discoveries.

The first thing I wanted to know was what was a WM6.5 without any theme, any color configuration... well, here it is:


Scary isn't it? Specially the menu once that the gray text are the disabled items, the active options are black-on-black.

Anyway, to remove the themes and other color information I deleted the following registry keys:

[HKEY_LOCAL_MACHINE\System\GWE]
[HKEY_LOCAL_MACHINE\Software\Microsoft\Color]
[HKEY_CURRENT_USER\Software\Microsoft\Today]


After a soft reset I was presented with the screens above, then I checked the deleted keys to see if they were restored, and they were. Those are the very default of the keys above:

[HKEY_LOCAL_MACHINE\System\GWE]

[HKEY_LOCAL_MACHINE\System\GWE\Display]
"LogicalPixelsY"=dword:00000080
"LogicalPixelsX"=dword:00000080

[HKEY_LOCAL_MACHINE\Software\Microsoft\Color]
"BaseHue"=dword:0000007b

[HKEY_CURRENT_USER\Software\Microsoft\Today]
"Restriction"=dword:00000000
"MultiColorThemeEnabled"=dword:00000000
"UseStartImage"=dword:00000000
"DPI"=dword:00000080

[HKEY_CURRENT_USER\Software\Microsoft\Today\Keys]

[HKEY_CURRENT_USER\Software\Microsoft\Today\Keys\112]


There are a lot of information on the Internet about the themes and colors, and a lot of undocumented features too... And in this process I'm discovering a little bit of both.

Sunday, February 14, 2010

Build Asmmeta failing because it's unable to get a reference to an object.

Today I was working with some Windows Mobile project and that required me to add some XMTA files and everything was working just fine until I add a new XMTA file.

When I hit the build button, the build failed with the following message:

There was an error finalizing type . Object reference not set to an instance of an object.

I've spent the last hour searching over the Net to ind a solution. But everything that I found about the failure of generating assembly meta-data was in reference to some method that doesn't implemented an abstract method, or similar.

It was only in a comment from Alex Van Den Bosch, in Morten Nielsen's blog that I (out of desperation) found the solution what appeared to be the:


"change the build action of the XMTA to Content"


After I changed this the error didn't show up, but the assembly meta-data does not get created.

Well... back to the drawing board...

Friday, February 05, 2010

Using MSBuild Community Tasks unobstrusivelly

If you ever use any of the MSBuild Community Tasks (MSBCT) when building a project in any of the Visual Studio version since 2005, you may have noticed that when you first load a project that uses this tasks, a Security Warning Dialog is displayed.

Although it occurs only once or twice, it can be very annoying if you handle several projects.

So, reading the page on MSDN, I've added the MSBCT as Safe Imports tasks.

This file contains the necessary settings to make MSBCT a Safe Import for every version of Visual Studio: 2005, 2008 and 2010.

OBS.: If you installed the MSBCT in a folder other than C:\Program Files\MSBuild\MSBuildCommunityTasks before using it, change the settings to the proper path.

Wednesday, February 03, 2010

Why shadowing properties and methods is NOT a good thing!

I know it's old news but it's never too much to add emphasis on this:

Thou SHALL NOT shadow properties or methods.


And heres why.

Consider the following classes:

Class Class1

Property BaseProperty = " Base Property "

Overridable Property OverridableProperty = " Overridable Property "

End Class


Class Class2
Inherits Class1

Shadows Property BaseProperty = " Shadow Property "

Overrides Property OverridableProperty = " Overriden Property "

End Class


Pretty simple and basic.

Now, consider the following method:

Sub Main()

Dim c1 = New Class1
Dim c2 = New Class2

Console.WriteLine("c1.BaseProperty = " & c1.BaseProperty)
Console.WriteLine("c2.BaseProperty = " & c2.BaseProperty)
Console.WriteLine("CType(c2, Class1).BaseProperty = " & CType(c2, Class1).BaseProperty)
Console.WriteLine()

Console.WriteLine("c1.OverridableProperty = " & c1.OverridableProperty)
Console.WriteLine("c2.OverridableProperty = " & c2.OverridableProperty)
Console.WriteLine("CType(c2, Class1).OverridableProperty = " & CType(c2, Class1).OverridableProperty)
Console.WriteLine()

Console.ReadLine()

End Sub


And its result:

c1.BaseProperty =  Base Property
c2.BaseProperty = Shadow Property
CType(c2, Class1).BaseProperty = Base Property

c1.OverridableProperty = Overridable Property
c2.OverridableProperty = Overriden Property
CType(c2, Class1).OverridableProperty = Overriden Property


And that's why, young Grashopper, you should never shadow properties or methods.

You have no control over what's the user will do.

Tuesday, February 02, 2010

This blog (and site) will soon be moving...

Today I've got news that blogger will no longer support publishing posts over FTP, which I use to publish my little corner in the web.

Adding to this the fact that I'm starting my own start up company, in a couple of weeks this blog and site will be in a brand new home.