Search Pocket PC Life's 126 Pocket PC-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
PROGRAMMING POWER
Palm-sized input panel quirks and mounted database volumes
By Steve Makofsky

Welcome to Windows CE Magazine's Programming Power column. Each month we address tough issues about writing software for Windows CE and provide solutions that usually include a code snippet or two.

Based on reader questions and feedback, every month we select questions that are common stumbling blocks in Windows CE development. Want to know how to work around an API that's not available on Windows CE? Need help determining if your code will work on both a palm-sized PC and a H/PC Pro? Send us email at poweranswers@bsquare.com, including code where appropriate, and we'll try our hardest to find a resolution for you.

Most of the topics we cover are for those of you using the Visual C++ Toolkit for Windows CE, but we'll address occasional questions about Visual Basic for Windows CE and other development tools as well. Let's jump into this month's questions:

How can you determine if the SIP (Software Input Panel) API (Applications Programming Interface) is available on a device at runtime?
There are two different methods for handling application development across the various Windows CE platforms:

Method #1 -- static linking using definitions
The easiest way to deal with the differences in handheld PCs (H/PCs) and palm-sized PCs (P/PCs) is to have conditional #ifdef statements in your code which will only compile specific API calls if a certain platform is defined. When compiling, the build process will ignore any code inside your #ifdef statement if the condition isn't defined. Since you'll be performing separate builds for each platform, you can also have multiple resource files, which make user interface development easier when dealing with the difference between palm-sized PCs and other Windows CE devices. You can use the #ifdef statement as follows:

#ifdef PALMSIZEDPC
if(SipStatus() == SIP_STATUS_AVAILABLE)
fSipAvail = TRUE;
#endif

You might already notice the big downside to this method -- you'll need to distribute separate executables for both the H/PC and the palm-sized PC.

Method #2 -- dynamic linking
If you'd rather only distribute a single executable, you can determine what functions are available on the running platform by dynamically linking with functions. The function SipStatus() is used to determine the current availability of the SIP on Windows CE 2.1 and higher. This function (and the other SIP calls) are located in \Windows\Coredll.dll. So, in order to determine if you're running on an H\PC Pro or a palm-sized PC, you can code this:

typedef BOOL (*PCORE_SIPSTATUS)();

BOOL IsSIPAvail()
{
PCORE_SIPSTATUS lpfnSipStatus = NULL;
HINSTANCE hCoreInst = NULL;
BOOL fSIPAvail = FALSE;

// Load up coredll.dll and hook into the SipStatus function
if((hCoreInst = LoadLibrary(TEXT("\\windows\\coredll.dll"))) != NULL)
lpfnSipStatus = (PCORE_SIPSTATUS)GetProcAddress(hCoreInst, TEXT("SipStatus"));

// If SIPStatus is there, then call it to see if it's available
if(lpfnSipStatus != NULL) {
if(lpfnSipStatus() == TRUE)
fSIPAvail = TRUE;
}

FreeLibrary(hCoreInst);
return fSIPAvail;
}


1  ·  2  ·  3  ·  Next »
Other articles you might like
Home > Phones and PDAs > Windows Mobile > Programming (3 articles)
   HP hotkeys, OK buttons, and file existence
   Freeing up DLLs, avoiding suspend mode, and listbox tricks
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
More from the ZATZ journals
Computing Unplugged: Eight steps to successful and reliable home backups
David Gewirtz Online: CNN commentary and analysis
DominoPower: What to look for in a Domino-based document management solution
OutlookPower: Can Outlook run when it's not running (and other mysteries)?
-- Advertisement --

BLOGGING AND PODCASTING WITH ONE EASY-TO-USE TOOL
Now you can publish your thoughts, opinions, and comments in your own blog or podcast.<p />

  • Supports multiple authors and multiple blogs or podcasts.
  • Generate and publish RSS feeds for iTunes and other directories.
  • Post photos, images or animations.
  • Get feedback and have conversations with visitors to your site. <p />

Personalize your blog or podcast with your own unique domain name -- or integrate it with your existing site by setting it up as a subdomain.

Tap here and get blogging or podcasting within minutes.

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1999-2009, ZATZ Publishing. All rights reserved worldwide.
Editor's Login