与其他应用程序集成 > Windchill Workgroup Manager 文档 > Windchill Workgroup Manager 工具包 > Creating and Modifying Toolkit Applications > How to Initialize and Launch the Toolkit
  
How to Initialize and Launch the Toolkit
The Windchill Workgroup Manager Toolkit needs to be configured with the Windchill Workgroup Manager client to successfully test and use the Windchill Workgroup Manager Toolkit applications.
Configuring Client to Load a Toolkit DLL
After the customization DLL file is built, configure the Windchill Workgroup Manager launch process to initialize and load the Windchill Workgroup Manager Toolkit DLL, and to call the entry point functionality.
Two parameters are configured within Windchill Workgroup Manager for each customization DLL:
The full path to the customization DLL. For example, %WWGMTK_INSTALL_DIR%\settings\Release\WWGMTK_PROJECT_NAME.dll
The customization name identifying the DLL application. The name must be a unique string.
Use the customization name when sending commands to a Windchill Workgroup Manager customization DLL. For example, if a CAD customization sends a command using the executeCustomCommand method, it specifies the name of the Windchill Workgroup Manager customization to which this command is addressed. For example,
client —>executeCustomCommand (“wwgmtkAPIDemosCustomizer”,params..dict);
Application Startup Sequence
The Application Startup Sequence explains the initial handshake between the Windchill Workgroup Manager client, and the Windchill Workgroup Manager Toolkit DLL.
Upon startup, Windchill Workgroup Manager looks for a customization registry file. This file contains parameters for each of the customization DLLs. The registry file can be created by Windchill Workgroup Manager by providing the dedicated flag -wwgmtk_create_reg_file with customization name and full path to DLL. For example,
-wwgmtk_create_reg_file <name1> <full\path\to\dll1>, <name2> <full\path\to\dll2> …
In this example, the flag instructs Windchill Workgroup Manager to create a registry file with one or more customization DLLs. The registry file is used when the Windchill Workgroup Manager client launches. The registry file argument is followed by a comma-separated list of pairs; where each pair has a name and a path separated by a space. Paths containing spaces should be put in quotes.
For example -wwgmtk_use_reg_file “full\path\to\xml\file.xml" specifies where to create the registry file if using the -wwgmtk_create_reg_file flag or the location of a pre-existing XML file.
In addition to the initialization of the customizations defined in the XML file, the Windchill Workgroup Manager client checks each loaded client-side adapter and initializes the existing adapter customizations.
* 
If using -wwgmtk_create_reg_file without including the -wwgmtk_use_reg_file, the registry file by default goes to %APPDATA%\PTC\Windchill Workgroup Manager\.Settings\customizationTK.xml. If the user environment variable PTC_WGM_ROOT is defined, then this file is created in the %PTC_WGM_ROOT%\.Settings folder.
After a registry file is created, it can be modified manually to add or remove applications.
Flags can be used independently or together.
The following sequence of calls happen during the Windchill Workgroup Manager startup whenever the Windchill Workgroup Manager client loads and initializes the toolkit applications.
1. Based on the startup flags, the Windchill Workgroup Manager client loads all registered toolkit applications.
2. For every application loaded, Windchill Workgroup Manager looks for the wwgmtkGetCustomizer()command. It’s purpose is to call and receive pointers to and from the wwgmtkClientCustomizer interface.
If the pointer returned is NULL, or if the functionality is not exported, Windchill Workgroup Manager discards the toolkit DLL.
3. Next, Windchill Workgroup Manager calls the wwgmtkClientCustomizer::initialize()command.
Its purpose is to call and receive pointers to the wwgmtkClient interface, and to store this pointer for the future use of Windchill Workgroup Manager APIs.
4. The toolkit may also return the wwgmtkError_Abort from initialize()command. Its purpose is to disable itself from future use byWindchill Workgroup Manager when an error occurs during initialization.
* 
In initialize(), the application may use theWindchill Workgroup Manager APIs in the wwgmtkClient interface. It may also place user interface elements or listeners to be invoked at a later point by Windchill Workgroup Manager events.