Author's Note

Purpose

This program is a little personal project of mine to experiment with Win32 API. It is written in C++ unmanaged code. The source code is available for download under the GNU General Public License.

This project is also another reason to retire the predecessor project, which was done in early 2007. Frankly, I was getting bored of my older program until I saw HTC Home plug-in, which inspired me to work on a new program.

 

Personal Log

7 February 2008

  • Started working on this project during Chinese New Year.

28 February 2008

  • Took about one week to finish the program but had to extend one and a half more week to solve a significant performance issue. Found out that the AlphaBlend API can be quite CPU intensive on the Pocket PC if included in every paint loop. Had to do some tricky triple buffering in order to reduce the alpha blending occurrence. The extended time also covered the writing of the binary-resource-to-file function for the default font file recreation.
  • Spent a couple of days on custom font making.
  • Used another three days to write this web site.

29 February 2008

  • It was reported that this program (RC 1.0) may not run on Windows Mobile 6.1, which Microsoft has yet to announce officially as of this writing. Now solved with RC 1.1. The problem lied with either AddFontResource API or WM_WININICHANGE message broadcast.

4 March 2008

  • Thanks to the freezing problem caused by AddFontResource API, its removal broke my program and I had to spend a couple of days to redesign much of the program logic. See Version History for more details.

6 March 2008

  • Added some Google gadgets to the site just for fun.

7 March 2008

  • Reworked on the program for some minor changes. See Version History for more details.

12 March 2008

  • Although the font problem was supposed to be fixed in RC 1.1, it seems like some programs like HTC Cube will still grab the custom font indiscretionally. After racking my brain for the past few days, I decided to use font link to solve this problem once and for all. The idea is to map the glyphs in the custom font to unused characters in the BMP Unicode range and link the custom font to Tahoma. If this idea works, I will need to remake all custom fonts.
  • Going to give the AddFontResource API another shot and see if it will still hang devices. This time I will check if the custom font is added successfully before I call RemoveFontResource function. Not going to broadcast WM_FONTCHANGE since not required by other programs.

13 March 2008

  • Released RC 1.3 with the changes I specified yesterday. This version is distributed privately to selected forums for testing only.

16 March 2008

  • Done lots of modifications to the program. Mainly worked on dynamic text alignment in preparation for variable font size of the time elements. Also changed the way how the plug-in resizes itself.
  • As requested, I added some registry values which give users more options to change the look of the program, which I think is essential as well. But, why registry? Well, firstly, it is the easiest way to store users' data, and secondly, I still can't find a good example on how to create an option page with property sheets.
  • So far I am happy with the results after the release of RC 1.3 and I have decided to go gold today. Gamma test phase is over and Pocket Digital Clock is officially Version 1.0 now.

17 March 2008

  • The path name of Program Files in Windows (in general) may vary due to different languages used by the OS. I overlooked this and hard-coded the name of the path where the custom font file resides, resulting in font not found on some Pocket PC devices. I had to quickly release a minor update. Big thanks to Andreas Selle for pointing this out.
  • I need some rest. Update of some web pages will have to put on hold.

19 March 2008

20 March 2008

  • Released another minor fix today. Normally, when a character is not found in the base font (PDC) using font link method, it will look into the linked font (Tahoma). On the Far East Windows Mobile, the GetTextExtentPoint function unexpectedly read the width of the Undefined glyph in the base font before checking the linked font. The width of the Undefined glyph is doubled that of the numeric glyphs, therefore, creating extra space between the hour, minute and second digits. The height of the digits was unaffected since I used a different function for it. Eventually, I had to explicitly use the Unicode glyphs in the base font to solve the problem. The English OS did not exhibit this behavior though. Quite puzzling indeed.
  • Added the Frequently Asked Questions page.

21 March 2008

  • Added one more registry tweak to enable or disable the alarm icon display.
  • I was wondering why there were still so many installation and uninstallation woes. So I looked into the PDCsetup.dll file used for installing and uninstalling the program and found a couple of handles to opened registry keys not closing properly after use. Released another minor fix today and hoped that the installation and uninstallation processes would be smoother now.

27 March 2008

  • My Clicky free trial had just ended. I didn't expect my site to get disqualified from their basic service after the free trial. Well, I guess I should be happy because this means that I'm getting traffic on my site. Looks like I'll have to find another Google gadget for logging visitor counts.

 11 April 2008

  • For the past 3 weeks, I had been studying on how to get property sheets to work on Windows Mobile. Understanding the property sheet API is no big problem but getting it to display properly in Pocket PC style can be quite challenging. I was having a tough time trying to imitate the look and feel of the tabbed dialogs in Windows Mobile. I actually gave up half way when I could not get the dialogs to close properly. The soft key bar also behaved strangely when SIP was enabled in the tabbed dialog view. Then I went to check out LVMTime source code and learned about tab controls instead. Soon enough I was able to get tabbed dialogs working however they did not feel right. I was not satisfied with the tab controls because child dialogs could not get focus when navigating using the directional pad. Feeling hopeless, I went back to property sheet basics and happened to find some good examples on property sheet in the Windows Mobile SDK folder. Eventually, I managed to resolve my property sheet problems with the help of the Crossword and myBackLight samples.
  • During that time, Microsoft officially announced Windows Mobile 6.1. I was laughing when I heard the news because Pocket PC OEMs had been selling devices with this version of the OS for months before the announcement. And thanks to the official release, I was able to get my hands on the Windows Mobile 6.1 Emulator and successfully tested Pocket Digital Clock on it.
  • Due to many requests and after looking at the new Windows Mobile Today Screen, I decided to add the network operator name on to Pocket Digital Clock. Getting the current network operator name to display is much more trickier than I had thought.
  • Finally finished Pocket Digital Clock Version 1.1 with the much needed option dialogs for changing different aspects of the plug-in. It took me quite a while to create the option dialogs for Pocket Digital Clock since this was the first time I actually worked on dialog boxes using native codes only. Much time and effort was spent to understand the various dialog controls available on the Pocket PC. I guess I would expect many bug reports in this version of the Pocket Digital Clock due to lots of new stuff added. The size of the main DLL was actually doubled!
  • Customization page will be down indefinitely until I redo the entire page with details of the new option dialogs. The More Registry Tweaks page needs updating too since I've included some extra registry keys in this version. End-users do not have to worry about these new keys.

15 April 2008

  • Reconstructed the entire Customization page with details of the new option dialogs.
  • Performed maintenance on some other web pages.
  • Removed Visitor Map and replaced Clicky with ClustrMaps. Although I prefer hit counters that utilize Google Maps, I don't have many choices if I want a free one.

16 April 2008

  • Discovered the function that reads the registry string for FileOnAction is flawed. The function will fail to read this registry string due to incorrect byte size specified for the string. The function therefore overwrites FileOnAction with the default value and discard any the user settings.
  • While fixing the above problem, I also took the opportunity to rewrite the function that writes registry strings when there are changes in the option dialogs. The last parameter in the RegSetValueEx function is now size of TCHAR times string length of the buffer (inclusive of the null-terminated character) instead of size of the buffer. This should give the correct byte size for Unicode characters. I believe this is the cause of the problem for option dialogs not being able to close properly.
  • Released a minor fix for the above amendments.

17 April 2008

  • Since the initial release of Pocket Digital Clock, it was plagued by font issues due to customized font implementation. As mentioned before, the use of custom font will corrupt the fonts in other applications. There has been a number of workarounds floating on the Internet but none of them are 100% working. After much experimenting, I think I might have found the "perfect" solution. I discovered that if the weight in font setting (not naming) of the custom font is normal or regular, programs that do not explicitly specify a font will not use the system font but instead use the custom font loaded from \Windows\Fonts\ or via AddFontResource function call.
  • Released a new update today to fix this font problem once and for all (I hope). Had to redo all the 29 custom fonts on this site to change the font weight in the font settings too.
  • Rewritten much of the code so that operator name is updated every three seconds instead of depending on registry notifications and at the same time trying to lessen the burden on WM_PAINT. Now RegistryNotifyWindow is called only when required.
  • Included a couple of much-needed functionalities to the plug-in, in particular the tap-and-hold gesture. Now you do not have to worry about accidental taps on Today Screen. The other feature is to enable ClearType for Pocket Digital Clock only (non-global).
  • I decided to relax the restriction on the date format based on orientation and system text size. You can now use long date format unless orientation is portrait and system text size is set to largest. Previously, long date format is only available when system text size is the default or normal size.
  • I also removed the checking on Tahoma font from the program. This means that users with overridden system font will be able to use Pocket Digital Clock now. The only problem I foresee is that time separators other than colon(:) and period(.) will be displayed as square boxes if Tahoma font is not found in the device.
  • Visitor Map page is back. This time, I am using a service called gVisit.

19 April 2008

  • Found out that localized version of Windows Mobile that depends on font linking to display Unicode characters may not render these characters correctly in Pocket Internet Explorer with Pocket Digital Clock installed. The link between PDC font and Tahoma font is not enough to link PDC to the Unicode font. A direct font link must be established instead.
  • PDC font now linked to the following fonts other than Tahoma.
    • Traditional Chinese font: PMingLiu (mingliu.ac3)
    • CE-Star localized TrueType font: UniSun (sunglobe.ttf)
  • Fonts for the option dialogs are now changed to Tahoma instead of MS Shell Dlg. Localized version of Windows Mobile may not use Tahoma to display the user interface and these system font will distort the controls in the option dialogs of Pocket Digital Clock.
  • Added some codes to test if the dummy dialog is closed properly before the property sheet for the option dialogs can be created.
  • Release a private version on xda-developers forum to test the font linking for Tradition Chinese.

20 April 2008

  • Linking the rest of the East Asian font files and names to PDC registry value is not effective. Furthermore, long registry value will be ignored by the system. In order to create dynamic font linking, I used the SetupDLL to append the content in Tahoma registry value to PDC. Reason being Tahoma is linked with the Unicode base font on localized versions of Windows Mobile. And based on the previous findings, I need to link PDC directly to the Unicode base font to resolve the problem of fonts not displaying correctly on PIE.
  • Replaced the related registry subkeys, i.e. OverrideAlphaDayDateOpacity, OverrideAlphaDayDateRGB, OverrideTimeOpacity and OverrideTimeRGB, with one OverrideARGB subkey. Instead of four separate variables, we now employ bit-masking and only need one to store the states of the check boxes for the Background Opacity and Color dialog.

21 April 2008

  • I guess linking the PDC default font to the Unicode base font on localized Windows Mobile is not such a good idea after all. It was reported that Pocket Internet Explorer used the ugly alphanumeric characters in the Unicode base font to display English words instead of the default Tahoma font after version 1.1.1.2.
  • It was fortunate that the zDigi.ttf file that kwickone provided on xda-developers forum did not cause any strange font corruption on PIE. After a number of guesses and trail-and-errors, I managed to pinpoint the font settings affecting how PIE uses fonts. It seemed like the PANOSE values in font settings were imported from Tahoma font and they resulted in some unexpected behaviors on localized Windows Mobile. Overwriting the PANOSE values with zeros resolved the font problem. However, we still need a non-regular weight font setting to prevent other applications from using the custom font.
  • Since zeroing all the PANOSE values has taken care of the font problem on PIE, the dynamic font linking is not required any more. Relevant codes were removed from SetupDLL and released another minor fix today.
  • Had to redo all the font files to amend the PANOSE values.

23 April 2008

  • Web site maintenance. Added exclamation symbols to emphasis important points.

25 April 2008

  • I was trying to take some screenshots of Pocket Digital Clock on Windows Mobile 6.1 and noticed the font size for the second digits and time markers did not save correctly after closing the option dialogs. Then I found out that part of the registry updating function was not changed to follow the new rules set during the option dialog implementation. Previously, the second and time marker font size must be a certain fraction of the hour/minute font size. This is now lifted and is only restricted to the size of the hour/minute font.
  • Added a couple of new screenshots.

30 April 2008

  • Some users still encountered trouble with reinstalling/uninstalling the program. My guess is the font file or a certain registry value is locked by the operating system, resulting the uninstaller to fail when removing the program files and related registry keys. If the user proceeds with reinstallation/upgrade after the system prompts about program not being removed properly, the Setup DLL could have been overwritten and the installation process cannot be re-initiated until the Today registry key is removed. There is not much I can do to about the CAB/Installer since the installation process is by design but I can explicitly remove the Today registry key before the CAB/Installer starts to install or reinstall.
  • While working on the function to remove the Today registry in the Setup DLL, I also explored the possibilities of retaining user settings in the option dialogs. Created a solution so that the registry values used in the option dialogs can be copied to a temporary registry key and restored when reinstallation is done.
  • It was reported that QuickMenu is conflicting with Pocket Digital Clock. I tested both programs and noticed that QuickMenu will crash if the option dialogs for Pocket Digital Clock is called via QuickMenu by tapping on the Windows logo on the top left corner (not the Start keyword). I discovered that a Shell API function is causing this "problem". The said Shell API function is the SHGetSpecialFolderPath function required for adding and removing font resources in the Program Files folder. Replacing the function call during application shut down seems to stop the crashing.
  • When QuickMenu does not crash, it breaks some of the functions of Pocket Digital Clock. For some unknown reason, QuickMenu is preventing the option dialogs from "talking" to the plug-in. I also noticed QuickMenu will force Pocket Digital Clock to close every time the Today Settings window is accessed. This could have caused my global variables in the application to be reinitialized. I had to add extra but redundant function calls to retain the values in these global variables.
  • Due to the extra lines of codes, the source file is becoming too long. I took this opportunity to split the program into multiple files for easier reading and maintenance. I also wanted to make sure that my global variables are working using external linkage. Unfortunately, the extern keyword did not fix the queer behavior caused by QuickMenu.

2 May 2008

  • Today I confirmed that broadcasting a WM_FONTCHANGE message will crash some devices and lock them up until a hard reset is realized.
  • I'm not very happy with the way Pocket Digital Clock now has to keep reading from the registry to update correctly when using with QuickMenu. I emailed the author of QuickMenu and hoped for some response that may help me work out a cleaner solution. At the same time, I added a temporary registry value to flag for a full registry read only when the option dialogs close instead of every plug-in refresh via WM_CREATE message. This should prevent the registry from being accessed too frequently and slow down the device.

10 May 2008

  • My Google AdSense application has been approved yesterday but I only got time to add some ads to my web site today.

18 May 2008

  • It had been a hectic week and I'm sorry the promised update was being delayed.
  • As reported, custom fonts were still affecting the font size on HTC TouchFlo Cube. Looked like the font weight fix on 21 April 2008 was not good enough. Setting the custom font weight from Medium to Bold seemed to work. So once again, all custom fonts had to be edited.
  • Tidied up the Tap-and-Hold gesture function and at the same time, added a Next Alarm feature similar to the one in Spb Time. By tapping and holding the alarm clock icon on the Today Screen when the system alarm is enabled, the context menu will pop up with an extra line indicating the remaining time of the next upcoming alarm.
  • Had some technical difficulty when trying to create property sheet pages directly from Today Screen. Problem being not able to switch to Today Screen other than closing the option dialogs. The workaround is to create a dummy dialog box without specifying a parent window handle before the property sheet, very much like how things were done in the CustomItemOptionsDlgProc export function. During the process, I had to restructure the header to reuse some functions.
  • With the help of a friend, Zman, I was able to implement a String Table in to the Pocket Digital Clock project correctly. Programmers who are interested in compiling localized versions of Pocket Digital Clock only need to look into the resource files now.

22 June 2008

  • The Next Alarm text string seemed to be a little too long and was truncated most of the time. By replacing some words to just the first letter of these words may help improve the readability.
  • Since people had trouble removing the AM and PM time markers on the plug-in, I decided to add a check box to show or hide the time markers as opposed to configuring this in the Regional Settings.
  • I remembered someone mentioned about trying to get Pocket Digital Clock to occupy the entire screen in landscape mode. So I increased the maximum font size for the time digits so you can do some crazy blowing up of the clock. I also added an adjustable vertical border that allows you to set extra space above and below the plug-in which in turn helps to centralize the time digits vertically.
  • I had to add an extra tab in the option dialogs to accommodate the additional features and do some rearrangement. I took this opportunity to add a new day/date alignment which I never had a chance to.

26 June 2008

  • For some devices, the Today Screen does not get an immediate refresh when Windows Mobile wakes up from suspend mode. This is true even if you set a faster repaint rate in the program logic. There seems to be an average delay of 500 milliseconds before a power transition is detected by Windows Mobile. Thus Pocket Digital Clock is unable to update the time immediately when pressing the power button and will incorrectly show an earlier time in a glance before refresh kicks in. To avoid this problem, an option is added to disable the time display when power off is detected. Note that the program is still running after a power off. It will only come to a full halt when a suspend notification is sent by Windows Mobile. So technically, the option should read as "Hide time display when powering off" instead. When the device resumes from suspend mode, the time display is blank for that 500-milliseconds delay before the program can repaint to show the correct time. This feature is supposed to come with version 1.1.4 on 22 Jun 2008 but was pulled out at the last minute due to non-working codes.
  • Due to the recent computer breakdowns, I was not able to work on this project more often as I wanted. And sad to say, this may be the last update since I believe the life cycle of this application is nearing its end.

10 July 2008

  • Upon request, I added some registry values which allow you to tweak individual display elements on the plug-in. So for example, you can now have red time digits, a yellow alarm clock icon and blue day/date text. For more information, lookup on the registry page for subkeys with the ColorEx prefix.

29 July 2008

  • I least expected users to override the default time marker string format, i.e. "tt", with a "tM" string format. Took me a while to realize how Windows Mobile interprets this string. At first, I thought that the "tM" string is locale specific. Instead, this string is actually made up of two components; a single character time marker string "t" and a constant character "M". I wrote a simple parsing function to read the time marker string more dynamically but if the time format string gets too complicated, results may vary from the time sample shown in Regional Settings.

3 August 2008

  • Found out that the GetLocaleInfo API for Windows Mobile does not read the leading zero for hours and 12/24-hour clock format if the time format string is overridden via the STFmt registry value. Fortunately, the time format string returned from GetLocaleInfo matches the STFmt registry value. Just added some simple checks to verify an override.

24 August 2008

  • After much consideration, I decided to remove the restriction for using long date format when system text size is set to largest AND screen orientation is portrait. The decision is made so that I do not have to create multiple versions of Pocket Digital Clock to accommodate day/date width for different regional settings and languages.


Updates

I like things simple. I do not wish to make my program into a bloatware. Therefore, I do not foresee any major updates in the near future unless I discover a critical bug in the program.

If you like frequently updated stuff, you should try BatteryStatus, rlToday or phoneAlarm instead. The mentioned programs are able to reproduce what my program can do, with extra bells and whistles, which I personally do not need.

  

Special Thanks

And lastly, many thanks to the people at PPCSG and xda-developers who helped test my program.

 

 

Cheers,

Ionized