[Windows Mobile Development and Hacking General] ins0mniaque:
Hello!

I recently purchased an iPaq hw6955 and fell in love with it. I have been coding on Windows for way too many years, yet this is the first time my PDA doesn't run Linux (or OpenBSD ;)).

I recently saw levenum's taskbar battery meter, and though that it would make a nice project for a first mobile application. How pleased I was when levenum accepted my request to share the sources. How even more pleased and surprised I was when I saw the code. It is exactly the same as coding on Windows...

So my idea was to have a fullscreen gradient bar that would look "behind" VistaBetaTWO's WA2 Aero skin. And I've done it (and it only weights 12 kb!).

Here is a screenshot for your viewing pleasure.

View attachment 31162

But after having read levenum's thread, I understood some people would like it thinner, etc... So there are tons of options read from the registry! The gauge should work on WM 5.0 PocketPC and Smartphone editions, and should handle screen rotation, but I can't test this because the emulator doesn't have an option to switch between landscape and portrait, and the hw6955 is a square screen device.

The registry keys are kept for each resolution, which I will write as "W x H". (e.g. The base key for my device (240 x 240) would be HKCU\Software\VistaHide\Battery Gauge\240 x 240\). All of these keys are independant (i.e. If you need to only modify the height of the bar, you only need to create the Height key.)

Options :

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\X

- Window's left position. Default : 0.

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Y

- Window's top position. Default : 0.

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Width

- Window's width. Default : -1.

- Note: Any value below 0 means fullscreen.

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Height

- Window's height. Default : 4.

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Thresholds\Critical

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Thresholds\Low

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Thresholds\High

- Value between 0 and 100 which represents the gradient thresholds.

- Default : (Critical) 0.05, (Low) 0.25, (High) 1.00.

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Colors\Background\Light

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Colors\Background\Normal

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Colors\Background\Dark

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Colors\Critical\Light

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Colors\Critical\Normal

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Colors\Critical\Dark

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Colors\Low\Light

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Colors\Low\Normal

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Colors\Low\Dark

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Colors\High\Light

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Colors\High\Normal

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Colors\High\Dark

- Colors! If you look closely at the screenshot, you will see that the bar is "beleveled". The light color is the top part, and dark one the bottom, everything in between is normal. Want to disable "beleveling" ? Set the light, normal and dark to the same color.

- Default values ( Light, Normal, Dark ) :

Background : RGB ( 64, 64, 64 ), RGB ( 32, 32, 32 ), RGB ( 0, 0, 0 )

Critical : RGB ( 255, 127, 127 ), RGB ( 255, 0, 0 ), RGB ( 127, 0, 0 )

Low : RGB ( 255, 255, 127 ), RGB ( 255, 255, 0 ), RGB ( 127, 127, 0 )

High : RGB ( 127, 255, 127 ), RGB ( 0, 255, 0 ), RGB ( 0, 127, 0 )

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Excluded Regions\{Anything}\X

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Excluded Regions\{Anything}\Y

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Excluded Regions\{Anything}\Width

[DWORD] HKCU\Software\VistaHide\Battery Gauge\W x H\Excluded Regions\{Anything}\Height

- Now for the fun part... This is how you can remove "parts" of the bar. For every key in "Excluded Regions", it will read a rectangle, and exclude it from the window.

- Default value : No excluded regions.

Example (I think it's necessary ;)) :

Here are the keys needed to achieve the look in the screenshot (at 240 x 240). It uses all the default values, except for 4 excluded regions (one per line).

HKCU\Software\VistaHide\Battery Gauge\240 x 240\Excluded Regions\Line 1\X : (DWORD) 13

HKCU\Software\VistaHide\Battery Gauge\240 x 240\Excluded Regions\Line 1\Y : (DWORD) 0

HKCU\Software\VistaHide\Battery Gauge\240 x 240\Excluded Regions\Line 1\Width : (DWORD) 11

HKCU\Software\VistaHide\Battery Gauge\240 x 240\Excluded Regions\Line 1\Height : (DWORD) 1

HKCU\Software\VistaHide\Battery Gauge\240 x 240\Excluded Regions\Line 2\X : (DWORD) 11

HKCU\Software\VistaHide\Battery Gauge\240 x 240\Excluded Regions\Line 2\Y : (DWORD) 1

HKCU\Software\VistaHide\Battery Gauge\240 x 240\Excluded Regions\Line 2\Width : (DWORD) 15

HKCU\Software\VistaHide\Battery Gauge\240 x 240\Excluded Regions\Line 2\Height : (DWORD) 1

HKCU\Software\VistaHide\Battery Gauge\240 x 240\Excluded Regions\Line 3\X : (DWORD) 10

HKCU\Software\VistaHide\Battery Gauge\240 x 240\Excluded Regions\Line 3\Y : (DWORD) 2

HKCU\Software\VistaHide\Battery Gauge\240 x 240\Excluded Regions\Line 3\Width : (DWORD) 17

HKCU\Software\VistaHide\Battery Gauge\240 x 240\Excluded Regions\Line 3\Height : (DWORD) 1

HKCU\Software\VistaHide\Battery Gauge\240 x 240\Excluded Regions\Line 4\X : (DWORD) 9

HKCU\Software\VistaHide\Battery Gauge\240 x 240\Excluded Regions\Line 4\Y : (DWORD) 3

HKCU\Software\VistaHide\Battery Gauge\240 x 240\Excluded Regions\Line 4\Width : (DWORD) 19

HKCU\Software\VistaHide\Battery Gauge\240 x 240\Excluded Regions\Line 4\Height : (DWORD) 1

EDIT: Forgot one neat feature... If you launch it while it is already running, it will close the running instance.

Hope you enjoy, and you can expect a lot more freebies like this from me in the future!