Well here is the code fixed up so it works both with the Treo 600 and the 
650
LionScribe


#include <HsAppLaunchCmd.h>

static Boolean callbackFunc(void* ref)
{
 return false;
}

Boolean Lookup(char * number) // number should be a straight 11 digit number 
like 18005551212
{
 DmSearchStateType stateInfo;
 UInt16 cardNo;
 LocalID dbID;
 UInt32 result;
 Err err;
 UInt32 dbCreator = 'PAdd';
 Boolean rv = false;
 SysNotifyParamType params;
 AddrCallerIDParamsType lookupParams;
 MemSet(&params, sizeof(params), 0);
 MemSet(&lookupParams, sizeof(lookupParams), 0);

 params.notifyType = addrAppNotificationCmdCallerID;
 params.notifyDetailsP = &lookupParams;


 lookupParams.lookupString = number;
 lookupParams.formatString = "^friendlyname"; // you can change this to 
whatever you want
 lookupParams.callback = callbackFunc;
 UInt32 plainVal = 0;
 lookupParams.ref = (void*)&plainVal;

 err = DmGetNextDatabaseByTypeCreator(true, &stateInfo, sysFileTApplication, 
dbCreator, true, &cardNo, &dbID);
 if (err)
 {
  dbCreator = 'addr';
  err = DmGetNextDatabaseByTypeCreator(true, &stateInfo, 
sysFileTApplication, dbCreator, true, &cardNo, &dbID);
 }

 ErrNonFatalDisplayIf(!dbID, "Could not find app");
 if (dbID)
 {
  err = SysAppLaunch(cardNo, dbID, 0, sysAppLaunchCmdNotify, 
(MemPtr)&params, &result); \
  ErrNonFatalDisplayIf(err, "Could not launch app"); \
 }

 if(lookupParams.resultString)
 {
  FrmCustomAlert(10024, "Name is ", lookupParams.resultString, ".");
  MemPtrFree(lookupParams.resultString);
  rv = true;
 }
 else
 {
  FrmCustomAlert(10024, "Name not found!", "", "");
 }
 return rv;
}




-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to