Pocket PC Creations (PPCC) custom points are COM objects not unlike ActiveX controls,
but somewhat simpler in design. They also have the unique requirement
of needing to be able to operate on both the PC and the Pocket PC, which
has several processor architectures (ARM, MIPS, SH3, though mostly ARM in 2007).
In order to create a custom point, code must be compiled using a
language capable of creating COM objects. PPCC custom points were
written in C++, which can be compiled for both the PC and the various
Pocket PC architectures. Visual Basic (VB) can create COM objects on the PC,
but unfortunately Embedded VB can only create interpreted .VB files,
which prevents it from being used for these purposes.
Please download SliderCustomPoint.zip,
a package which contains a fully compilable 'Slider' project. It includes
project files for PC and Pocket PC builds (Visual C++ and eMbedded Visual C++),
plus the PPCCOM.h object model file. Examine the code to understand the custom
point development process.
Custom points are very simple, and need to implement only one or two
interfaces. All custom points should implement the ICustomPoint
interface, which allows the point to provide standard PPCC functionality
(setting properties, display on page, storage of information, etc).
Additionally, most custom points implement the IPersistPropertyBag
interface, which allows the custom point to store any properties it
might have in the project file above and beyond the normal PPCC
properties such as Caption, ID Name, etc.
In return, PPCC provides a reference to an ICustomPointSite interface
via the ICustomPoint::SetSite() method. The ICustomPointSite interface
is the access point which allows the custom point to interact with the
project. At the most basic level it provides a simple means for
querying the stock properties of the point, setting and querying the
current value, and default handlers for most custom point functions. It
can also be used to obtain a reference to the rest of the PPCC object
model through GetApplication(), GetProject(), GetPage(), GetPoint().
Default implementations for many of the methods in ICustomPoint are
provided in ICustomPointSite, for example ICustomPoint::Paint() can be
reflected back to ICustomPointSite::DefaultPaint(). Through this
mechanism you only need to provide full implementations for the methods
where the custom point provides extra functionality. Everything else
can be reflected back to PPCC to provide default actions (in this case,
the default paint action simply draws the caption).
Unlike ActiveX controls, PPCC custom points are windowless by default,
so all events are passed to your implementation of ICustomPoint.
ICustomPoint::GetHeight() and ICustomPoint::Paint() are the core methods
used to allow the custom point to paint itself. ICustomPoint::OnTap()
is called to handle stylus taps landing on the custom point. If
anything more sophisticated is required, it is possible to create a
windowed custom point by creating a child window on
ICustomPoint::Show(), and destroying it in ICustomPoint::Hide(). The
parent window handle can be retrieved from the ICustomPointSite via
GetHWND().
Finally, the custom points PPCC lists in its "Add New Point" dialog are
enumerated by searching for COM objects which implement the PPCC custom
point category. The GUID for this category is
{EDF7BC-0AD0-42C8-8CB4-287A-D828EE12}. PPCC will also automatically
register all DLLs it finds in its home folder upon start up, both on the
PC and the Pocket PC. This allows custom point DLLs to be automatically
registered without requiring an explicit installation step (provided
they are self registering).
Note: We are always pleased to learn of PPCC custom points developed by
others, so please contact
CreativityCorp to advise of your creativity. There may also be a market for
your custom point.
Custom Points and COM Ports
Custom points are often
required to access COM ports, for example with the GPS
custom point to connect to GPS hardware. COM ports are treated as
special files, and are opened using regular Windows file APIs, e.g.: