PPCBrowser
PPCBrowser Use program-linking dialog box
#include <PPCToolbox.h> PPC Toolbox
OSErr PPCBrowser( prompt, applListLabel, defaultSpecified,
theLocation, thePortInfo, portFilter,
theLocNBPType);
ConstStr255Param prompt; prompt text
ConstStr255Param applListLabel; list title text
Boolean defaultSpecified; see below
LocationNameRec *theLocation; port to be selected
PortInfoRec *thePortInfo; returned port name
PPCFilterProcPtr portFilter; filter procedure name
ConstStr32Param theLocNBPType; NBP type code
returns Error Code; 0=no error
You can use either the PPCBrowser function or the IPCListPorts function
to locate a port to communicate with.
Use the PPCBrowser function to display the program linking dialog box,
which allows a user to select a port to communicate with.
prompt is a line of text that the PPCBrowser function displays as a
prompt in the program linking dialog box. If you specify NIL or an
empty string is passed, the default prompt "Choose a program to link
to:" is used.
applListLabel specifies the title of the list of PPC ports. If you specify NIL or an
empty string is passed, the default title "Programs" is used.
defaultSpecified if this parameter is TRUE, the PPCBrowser function tries to
select the PPC port specified by the parameters theLocation and
thePortInfo when the program linking dialog box first appears. The
locationKindSelector field in the location name record must be set to
the ppcNoLocation constant (which specifies the local computer) or
the ppcNBPLocation constant (which specifies the NBP object and
NBP zone). The ppcNBPTypeLocation constant is not supported for
matching. When matching the location, only the object string and the
zone string of the entity name are used-the type string is ignored.
When matching the port, the entire PPC port record (script, name,
and port type) is used in the port information record. The
location name record and the port information record can be left
un initialized if the defaultSpecified parameter is FALSE. The
authRequired field of the port information record is ignored.
portFilter parameter determines how the list of PPC ports is filtered. If this
parameter is NIL, the names of all existing PPC ports are displayed.
If this parameter isn't NIL, it must be a pointer to a port filter
function.
A sample declaration for a port filter function named MyPortFilter follows.
Pascal Boolean MyPortFilter (LocationNamePtr theLoc,
PortInfoPtr thePortInfo);
The PPCBrowser function calls your port filter function once for each port
before it adds that port to the dialog list. This function should return TRUE for
each port that should be displayed in the program linking dialog box, and FALSE
for each port that shouldn't be displayed.
The parameter theLocNBPType of the PPCBrowser function specifies the
NBP type passed to NBPLookup to generate the list of computers. If you
specify NIL or an empty string is passed, the default, "PPCToolBox", is used.
Note that the current computer is always included in the list of computers
(even if a location with the specified type does not exist for it). If the
parameter theLocNBPType contains either of the NBP wildcard characters (=
or ), the PPCBrowser function returns a paramErr result code.
If the PPCBrowser function returns noErr, the parameters theLocation and
thePortInfo specify the port chosen by the user. If the PPCBrowser returns
a userCanceledErr result code, the user clicked the Cancel button, and no port
was selected. If the function returns a memFullErr result code, there was not
enough memory to load the PPCBrowser package, and the dialog box did not
appear.
Note: You must not call the PPCBrowser function from an application that
is running in the background, since this function displays a dialog box on the
user's screen.
For an example program showing usage of this routine, see the description of
Specifying a Target Address.
Returns: an operating system Error Code.
noErr (0) No error
memFullErr (-108) Not enough memory to load PPCBrowser package
userCanceledErr (-128) User decided not to conduct a session