Ok, I can't resist a last cry for help...

So there is a way to list and select the active network panel 
connection. This API has existed ever since OS 2.0 when netlib was 
introduced. The API does not allow you add a new network connection, 
but you can make an existing one active.

There are a series of launch codes you can send to the network panel. 
The launch codes are defined in SystemMgr.h

#define sysSvcLaunchCmdSetServiceID                     20
#define sysSvcLaunchCmdGetServiceID                     21
#define sysSvcLaunchCmdGetServiceList                   22
#define sysSvcLaunchCmdGetServiceInfo                   23

I had created a header file that was supposed to be part of the SDK, 
but it doesn't look like it was released. Here is the important 
information from
NetServiceAPI.h:

#define maxServiceNameLen 32    // max length of a service name

typedef UInt32 ServiceIDType;
#define svcNoServiceSelectedID          (0)

// serviceListType is the parameter for the 
sysSvcLaunchCmdGetServiceList action code
typedef struct
        {
                Err error;
                UInt16 numServices;     // number of services available
                MemHandle IDListH;      // MemHandle to an array of serviceIDs
                MemHandle nameListH;
        } serviceListType;

typedef serviceListType * serviceListPtr;

// serviceInfoType is the parameter for the 
sysSvcLaunchCmdGetServiceInfo action code
typedef struct
        {
                Err     error;
                ServiceIDType   serviceID;              // passed in 
to specify service you want info about
                UInt32  reserved;               // RESERVED -- SET TO ZERO
                Char    serviceName[maxServiceNameLen]; // returns 
name of service
        } serviceInfoType;

typedef serviceInfoType * serviceInfoPtr;



sysSvcLauchCmdSetServiceID expects cmdPBD to point to a valid 
ServiceIDType value.

You can get the currently active serivce ID value by launching 
sysSvcCmdGetServiceID  with cmdPBP pointing to  a ServiceIDType value 
to hold the result.

sysSvcLaunchCmdGetServiceInfo can be used to get the name of a 
service by its ID value, cmdPBP must point to a service InfoType 
structure.


Finally you can get a list of all available services by ID and name. 
This allows you to display a list of available services to the user 
and get the service ID of the selected item. CmdPBP is passed with a 
serviceListType structure. The structure will return with a number of 
services and two memory handles. Your application is responsible for 
freeing the handles. The first handle contains a list of numServices 
serviceID UInt32 values. The second handle contains a packed list of 
numservices null terminated string service names.

you can covert the string list to an array of pointers with the call 
SysFormPointerArrayToStrings()

I hope this helps.

--- Gavin
-- 

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

Reply via email to