Hello all,
I am working on an application that is required to automatically add a new
connection to the Palm preferences following a HotSync, and if necessary
when the application is executed. The application is only required to run on
the Palm V/Vx.
To achieve my task I have used the Palm Connection Manager functions as
shown below:
void MyApp::AddConnection()
//adds a new connection in prefs
{
MemHandle hsrc;
char* psrc;
char* pName;
//get profile name from resource
hsrc=DmGetResource( 'tSTR',ConnectionNameString);
if(hsrc==NULL) return;
psrc=(char *)MemHandleLock(hsrc);
pName=(char *)MemPtrNew(cncProfileNameSize);
if(pName==0) return;
StrCopy(pName, psrc);
MemHandleUnlock(hsrc);
DmReleaseResource(hsrc);
//Add connection if it can't be found
if(CncGetProfileInfo(pName,NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL)!=0)
{
CncAddProfile(pName, 0, 19200, 2, 0, NULL, NULL, true,
false);
}
MemPtrFree(pName);
}
This function is called by the application constructor, and everything
appears to work OK.
However....I have noticed that the connection added by the function can not
be used until I have been in to the connection's Edit dialog (it is not
necessary to make any changes). Before this any attempts to use the
connection will result in the Service Connection Progress dialog showing
"Error: Serial: (0x0302)".
Can anyone help me solve this problem? Am I missing something obvious in my
use of the connection manager?
Nick Holliday
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/