- Palm OS 3.5 SDK on a Palm OS 4.0 device.
- Assume that FindServiceRecord does indeed return the record number for the
searched for service.
- SetActiveService Comes from the (problematic) NetServiceAPI.
{
DmOpenRef dbID;
UInt16 recordNum = 0;
UInt32 currentRecordID;
Err err = 0;
//open the database
dbID = DmOpenDatabaseByTypeCreator(NetworkPanelDBType,
sysFileCNetworkPanel,
dmModeReadWrite |
dmModeShowSecret);
if (!dbID)
{
err = 1;
}
else
{
//Find the given service by name
recordNum = FindServiceRecord(dbID, pszService);
}
//check for error and exit if no record found.
if(recordNum == dmMaxRecordIndex)
{
err = 1;
}
//get the uniqueID of the new record.
if(!err)
DmRecordInfo(dbID, recordNum, NULL, ¤tRecordID, NULL);
//Update the system preference and make it active.
if(!err)
err = SetActiveService(dbID, ¤tRecordID, true);
//close the database.
DmCloseDatabase(dbID);
}
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/