February 17, 2019
Hot Topics:

Creating Custom Today Screen Items

  • February 17, 2005
  • By Alex Gusev
  • Send Email »
  • More Articles »

Processing Window Messages

The window procedure of your custom Today item will handle all Windows messages. Most of them just pass to the default handler. You will be interested in processing the following messages:


Start from the WM_TODAYCUSTOM_QUERYREFRESHCACHE message. It will be sent to your component to determine whether your data has been updated. So, that's often a good place for requerying your data. Your sample component simply obtains new data values there. Remember that you should return TRUE if the component needs to be updated, or FALSE otherwise.

WM_TODAYCUSTOM_CLEARCACHE is sent to the component's windows when it is about to be unloaded. Here, you can release all resources that your component might use during its lifetime.

Now, here's an overview of newly introduced notification messages, which are controlled by the Selectability value in the Registry. Below, you'll find short explanations on each message. I'd like just remind you that Selectability should be equal to 2 to use and advantage most of these messages.

In the sample project, which is based on the Pocket PC 2003 SDK sample MemWatcher, you will use some of the notifications above. Even though your test project will not implement all the nice-to-have features, you'll get the general route of coding.

Processing 'Mouse' Events

When the user clicks on your custom component, WinProc will receive WM_LBUTTONXXX messages. You can process them and conduct specific actions in response to clicks. The sample project simply recognizes to which control area the click belongs, and responds by calling different Control Panel applets:

      RECT rcBattery;
      RECT rcMem;
      RECT rcStorage;
      POINT point;
      point.x = LOWORD(lParam);
      point.y = HIWORD(lParam);

      if (PtInRect(&rcBattery, point))
            NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi);
      else if (PtInRect(&rcMem, point))
            NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi);
      else if (PtInRect(&rcStorage, point))
            NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi);
         MessageBox(NULL, TEXT("Detected Screen Tap!"),
                   TEXT("Custom Today Item:"), MB_OK);

Similar behavior also is implemented for navigation buttons.


I hope this article has convinced you that creating custom Today items is kind of fun. You're set up well, having the plug-in's WinProc at hand to process all Windows messages. Besides, the Today API on Windows Mobile 2003 SE provides you with some additions that give you new features. With a relatively small effort, you're ready to create cool and powerful mobile applications.


Download the accompanying code's zip file here.

About the Author

Alex Gusev started to play with mainframes t the end of the 1980s, using Pascal and REXX, but soon switched to C/C++ and Java on different platforms. When mobile PDAs seriously rose their heads in the IT market, Alex did it too. Now, he works at an international retail software company as a team leader of the Mobile R department, making programmers' lives in the mobile jungles a little bit simpler.

Page 2 of 2

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date