Category Asynchronous mode, Object ProEngineer

Function ProEngineerConnect


Description
Causes the Creo Parametric TOOLKIT program to connect to an existing Creo Parametric process using a specified display. It is intended for use in simple and full asynchronous modes.
Synopsis
#include <ProCore.h>
ProErrorProEngineerConnect(
char* proe_session_id
/* (In)
This argument can be either empty string or identification string returned by ProEngineerConnectIdExtract. If it is ID string, the Creo Parametric TOOLKIT application will try to connect to the specified Creo Parametric session; if this attempt fails, the application will try to connect to any Creo Parametric session.
*/
char* display
/* (In)
The name of the display Creo Parametric is using. If this is NULL, match any display. If this is an empty string, assume the local host.
*/
char* user
/* (In)
The name of the user running the Creo Parametric to connect to. If this is NULL, match any user. If this is an empty string, assume the current user.
*/
char* textpath
/* (In)
The path under which the Creo Parametric TOOLKIT message and menu files are held. This is used in full asynchronous mode, or in simple asynchronous mode if text files are read (e.g., ProMessageToBuffer() is called). Otherwise, pass a null string.
*/
ProBoolean allow_random
/* (In)
If there is more than one Creo Parametric matching the constraints specified in arguments "display" and "user", choose one at random if this argument is PRO_B_TRUE; if it is PRO_B_FALSE, return an error.
*/
unsigned int timeout_sec
/* (In)
The time, in seconds, to wait for Creo Parametric to respond to the connection request.
*/
ProBoolean* random_choice
/* (Out)
If this is PRO_B_TRUE, more than one Creo Parametric met the specified criteria (allow_random was TRUE) and the function arbitrarily chose one Creo Parametric session.
*/
ProProcessHandle* p_handle
/* (Out)
A pointer to a process handle to be used in subsequent calls to Creo Parametric.
*/
)
Returns
PRO_TK_NO_ERRORThe connection succeeded.
PRO_TK_CANT_ACCESSNo network access.
PRO_TK_NOT_EXISTNo Creo Parametric session exists.
PRO_TK_E_IN_USECreo Parametric session did not respond to request for connection.
PRO_TK_ABORTCall to Creo Parametric interrupted.
PRO_TK_CANT_MODIFYCannot register connection with name server. If the environment variable PRO_COMM_MSG_EXE is not set, this value is returned.
PRO_TK_CANT_OPENCannot process request for connection to Creo Parametric session.
PRO_TK_E_DEADLOCKThe application and Creo Parametric deadlocked while trying to make a connection.
PRO_TK_E_NOT_FOUNDNo Creo Parametric session with the specified characteristics could be found, or information on the session could not be read from the name server.
PRO_TK_E_BUSYCreo Parametric session did not respond to request for initialization within timeout_sec seconds.
PRO_TK_E_AMBIGUOUSMore than one Creo Parametric session with the specified characteristics was found and random_choice was PRO_B_FALSE, preventing a session from being chosen.
PRO_TK_OUT_OF_MEMORYThere was insufficient memory to build a query to the name server.
PRO_TK_COMM_ERRORCreo Parametric session refused connection. (This can happen if application initialization fails.)
PRO_TK_INVALID_DIRtextpath is not a valid directory.
otherError status returned by the application's user_initialize().

Special cases:

  • if the application is running in native mode instead of Unicode, PRO_TK_BAD_INPUTS may indicate that prodev_text_path could not be converted to or from Unicode.
  • PRO_TK_APP_CREO_BARRED indicates an attempt to connect to a Creo application that does not support Creo Parametric TOOLKIT.

Manual References:

  1. Debugging Creo TOOLKIT Applications: Debugging an Asynchronous Spawn Mode Application
  2. Fundamentals: Creo Toolkit Support for Creo Applications
  3. Core: Asynchronous Mode: Simple Asynchronous Mode
  4. Core: Asynchronous Mode: Simple Asynchronous Mode
  5. Core: Asynchronous Mode: Simple Asynchronous Mode
  6. Technical Summary of Changes for Creo 11.0.0.0: Functions superseded from Creo 1.0 to Creo 11.0

Sample Code References:

  1. pt_async ( TestAsync.c )