|
|
| |
| We
wanted the application to feel as an organic extension
of the existing platform. Soon we realized that
our main goal should be focused toward integration
with the e-mail and contacts list. Through this
process we stumbled upon a few obstacles; some were
pure interface issues and some were technical in
nature. In this article we'll discuss the challenges
and solutions we used to implement this kind of
functionality in a Macromedia Flash application
on the Pocket PC. |
| |
 |
| The
Oddcast Character Messaging application |
| |
Sample
Files
Before you begin, download the source files for
this tutorial. |
|
| |
Connectivity
Challenges
First of all, the "sometime-connected"
issue has to be addressed. The Pocket PC device
may be offline part of the time. If you decide to
use the server to send an e-mail, you will need
to have a solution for connection detection and
data storing. This issue is well documented in Mike
Krisher's article Creating
Online Applications for "Sometimes-connected"
Devices. |
| |
| Another
consideration is the importance of the Contacts
applications on mobile devices and PDAs. Someone
recently told me that his Pocket PC is the "most
expensive phone book" he has ever owned. You
probably share my view that the Pocket PC can be
much more than that; however, you should keep in
mind that people usually keep all their contact
e-mail addresses on the Pocket PC. Therefore, forcing
users to peck away at the tiny on-screen keyboard
to write a whole e-mail address (including shifting
mode to find the ‘@') is an unacceptable user
interface design choice. |
| |
| So
what are our options? The easiest solution is to
delegate e-mail composing and sending to the e-mail-client
application; the other - fancier solution - is to
integrate with Outlook on the Pocket PC. In the
following sections we'll discuss both of these strategies. |
| |
Using
the Mailto Protocol
The easiest way to utilize an e-mail client is by
invoking it with the right parameters. This takes
care the two main issues: the user gets to use her/his
contacts, and the e-mail client deals with connection
management. As you probably know, this can be easily
achieved with a Macromedia Flash application through
the JavaScript mailto protocol, just like on a desktop
computer. All you need to do is to place the following
line of code in your Macromedia Flash movie: |
| |
GetURL("mailto:name@companyname.com?subject=Feedback&body=Nice
job") |
| |
| Unfortunately,
if you have made the inevitable choice of running
your Macromedia Flash application as a stand-alone
application (with or without FlashAssist PRO) you
will soon find out that mailto doesn't work under
the HTML Control. (The Microsoft PPC2002 HTML Control
doesn't handle hyperlinks). |
| |
| The
way to replace the mailto protocol is to use the
C++ (or VB) wrapper to launch the e-mail client
directly through the ShellExecuteEx
interface. The e-mail client executable file under
PPC2002 is "tmail.exe",
which resides in the Windows directory. The parameters
it takes are similar to the mailto protocol. The
following C++ code does the job: |
| |
int
rc = 0;
SHELLEXECUTEINFO sei;
memset(&sei, 0, sizeof(sei));
sei.cbSize = sizeof(sei);
sei.lpFile = _T("\\windows\\tmail.exe");
sei.nShow = SW_SHOW;
DWORD bWrite;
TCHAR urlStr[_MAX_PATH];
wstrcpy(urlStr,_T("mailto:support@companyname.com?subject=Feedback&body=Nice
job"));
sei.lpParameters=&urlStr[0];
rc = (ShellExecuteEx(&sei) != 0); |
| |
The
main drawbacks in this scheme are:
- The user is leaving your application to send
the e-mail message.
- Launching the e-mail client is a heavy task.
- The message data is not passed through your
servers.
|
| You
can resolve all these issues by integrating your
application with Pocket Outlook. Next, we'll show
you how to use an ActiveX Control that does just
that. |
| |
Using
POOM
Pocket Outlook® Object Model (POOM) allows you
to build Microsoft Visual Basic and Visual C++ applications
that access the data and functionality of the Pocket
Outlook application. Using POOM, we developed an
ActiveX Object that makes it possible for the user
to perform e-mail searches in Pocket Outlook based
on a contact's first name. |
| |
| The
VC++ project and sources are included in the sample
files available above. We've also included some
useful POOM documentation links at the end of this
tutorial. Due to the limited scope of this article
we won't go into the C++ code—but we'll describe
how to use it as a component. |
| |
| Creating
and calling the ActiveX Object is performed from
the HTML page using JavaScript. |
| |
<BODY
onload="init()">
<SCRIPT LANGUAGE=JScript>
var AX;
function init(){
AX = new ActiveXObject('chaMailAX.chaMailCTL');
}
</SCRIPT> |
| |
| The
ActiveX is windowless and is used only for processing.
(In other words, it has no user interface.) The
ActiveX connects to POOM once it is created. |
| |
| The
ActiveX findContact function allows
you to search for an e-mail in the contact list,
based on a contact's first name. The findContact
function receives a string and sets its e-mail property
to the e-mail address of the first match. Here's
the JavaScript function that calls the findContact
function and retrieves the result: |
| |
function
findContact(str){
AX.findContact(str);
e-mail=AX.e-mails;
} |
| |
| Now
we want to make everything work together in our
Macromedia Flash application. First, we need a text
field to receive the user's input and place the
text into a variable. Second, we need to call the
JavaScript findContact function and pass the input
string to it through the getURL
function. We can use a clipEvent
to trigger the call. |
| |
onClipEvent(keyUp){
if (name.length >= 3){
getURL("javascript:findContact('"+name+"')");
}
} |
| |
| Finally,
we'll use JavaScript to update the Flash object
(id="poom") as soon as the search is done.
Setting a dynamic text variable and then calling
a label inside our movie clip will accomplish that. |
| |
function
findContact(str){
AX.findContact(str);
e-mail=AX.e-mails;
poom.SetVariable("res",e-mail);
poom.TCallLabel("/","searchDone");
} |
| |
| We
can process the response inside the label frame.
This allows us to send an alert to the user in situations
where a matching entry was not found. |
| |
if
(res.length < 1){
res="No entries found";
} |
| |
Conclusion
The Pocket PC sets some limitations and difficulties
when implementing e-mail features. Integrating with
Pocket PC applications and components can overcome
most of these obstacles and greatly enhance the
usability of your Macromedia Flash application. |
| |
| The
following list of links may be useful when researching
this topic. |
|
|
| |
| |
|
|
About the author
Assaf Feldman is the Senior Director of Research
and Development at Oddcast
Inc.
|
| |