WinCreateObject: Difference between revisions
Appearance
mNo edit summary |
|||
Line 3: | Line 3: | ||
=== Parameters === | === Parameters === | ||
; className - [[ | ; className - [[PSZ]] - input : Class name of object. | ||
; titleOfObject - | ; titleOfObject - PSZ - input : The title to appear, when displayed, underneath an icon or in the titlebar, of the open object. | ||
; setupString - | ; setupString - PSZ - input : See the description for the Workplace [[OS2_API:WPLaunchPad|WPLaunchPad]] for a table of setup strings to customize the Toolbar. | ||
; location - | ; location - PSZ - input : The value can be in the following formats: | ||
Any predefined system folder object ids: | Any predefined system folder object ids: | ||
Line 19: | Line 19: | ||
The real name as a fully qualified path name. | The real name as a fully qualified path name. | ||
; creationFlags - [[ | ; creationFlags - [[ULONG]] - input : | ||
One of the following: | One of the following: | ||
* [[OS2 API:Constant:CO#CO_FAILIFEXISTS|CO_FAILIFEXISTS]] - No object will be created if an object with the given object ID already exists. This is the default. | * [[OS2 API:Constant:CO#CO_FAILIFEXISTS|CO_FAILIFEXISTS]] - No object will be created if an object with the given object ID already exists. This is the default. | ||
* [[OS2 API:Constant:CO#CO_REPLACEIFEXISTS|CO_REPLACEIFEXISTS]] - If an object with the given ID already exists, the existing object should be replaced. | * [[OS2 API:Constant:CO#CO_REPLACEIFEXISTS|CO_REPLACEIFEXISTS]] - If an object with the given ID already exists, the existing object should be replaced. | ||
* [[OS2 API:Constant:CO#CO_UPDATEIFEXISTS|CO_UPDATEIFEXISTS]] - If an object with the given ID already exists, the existing object should be updated with the new information. | * [[OS2 API:Constant:CO#CO_UPDATEIFEXISTS|CO_UPDATEIFEXISTS]] - If an object with the given ID already exists, the existing object should be updated with the new information. | ||
=== Constants === | === Constants === | ||
See [[ | See [[#Parameters|the paramters]] section. | ||
=== Returns === | === Returns === | ||
[[ | [[APIRET]] with values of: | ||
* [[ | * [[HOBJECT]] - Handle to created object. | ||
* [[ | * [[NULLHANDLE]] - Object creation failed. | ||
=== Define (C/C++) === | === Define (C/C++) === | ||
INCL_WINWORKPLACE | INCL_WINWORKPLACE | ||
=== Calling conversion === | === Calling conversion === | ||
Line 46: | Line 40: | ||
=== Example Code === | === Example Code === | ||
PSZ className; | |||
PSZ titleOfObject; | |||
PSZ setupString; | |||
PSZ location; | |||
ULONG creationFlags; | |||
APIRET rc; | |||
... | ... | ||
rc = WinCreateObject(className, titleOfObject, setupString, location, creationFlags); | rc = WinCreateObject(className, titleOfObject, setupString, location, creationFlags); | ||
Line 57: | Line 51: | ||
=== Related Functions === | === Related Functions === | ||
[[ | *[[WinDeregisterObjectClass]] | ||
[[ | *[[WinDestroyObject]] | ||
[[ | *[[WinRegisterObjectClass]] | ||
[[ | *[[WinReplaceObjectClass]] | ||
[[ | *[[WinSetObjectData]] | ||
=== Notes === | === Notes === | ||
Line 89: | Line 83: | ||
All parameters have safe defaults. It is not necessary to pass unnecessary parameters to an object. | All parameters have safe defaults. It is not necessary to pass unnecessary parameters to an object. | ||
[[Category:Win]] | |||
[[Category: |
Revision as of 22:07, 10 November 2016
WinCreateObject
- WinCreateObject(className, titleOfObject, setupString, location, creationFlags)
- Creates an instance of the object specified by className, having the title specified by titleOfObject, and places the icon and title in the location specified by location.
Parameters
- className - PSZ - input
- Class name of object.
- titleOfObject - PSZ - input
- The title to appear, when displayed, underneath an icon or in the titlebar, of the open object.
- setupString - PSZ - input
- See the description for the Workplace WPLaunchPad for a table of setup strings to customize the Toolbar.
- location - PSZ - input
- The value can be in the following formats:
Any predefined system folder object ids:
- "<WP_NOWHERE>" The hidden folder.
- "<LOCATION_DESKTOP>" The currently active desktop.
- "<WP_OS2SYS>" The System folder.
- "<WP_TEMPS>" The Templates folder.
- "<WP_CONFIG>" The System Setup folder.
- "<WP_START>" The Startup folder.
- "<WP_INFO>" The Information folder.
- "<WP_DRIVES>" The Drives folder.
The real name as a fully qualified path name.
- creationFlags - ULONG - input
One of the following:
- CO_FAILIFEXISTS - No object will be created if an object with the given object ID already exists. This is the default.
- CO_REPLACEIFEXISTS - If an object with the given ID already exists, the existing object should be replaced.
- CO_UPDATEIFEXISTS - If an object with the given ID already exists, the existing object should be updated with the new information.
Constants
See the paramters section.
Returns
APIRET with values of:
- HOBJECT - Handle to created object.
- NULLHANDLE - Object creation failed.
Define (C/C++)
INCL_WINWORKPLACE
Calling conversion
Example Code
PSZ className; PSZ titleOfObject; PSZ setupString; PSZ location; ULONG creationFlags; APIRET rc; ... rc = WinCreateObject(className, titleOfObject, setupString, location, creationFlags); ...
Related Functions
- WinDeregisterObjectClass
- WinDestroyObject
- WinRegisterObjectClass
- WinReplaceObjectClass
- WinSetObjectData
Notes
setupString contains "key=value" pairs that dictate the behavior of the object. Keyname/values are separated by semicolons, and values (per keyname) are separated by commas. For example,
"key1=value1,value2,value3;key2=value1;key3=value1,value2;key4=value1"
To have a literal comma or semicolon inside one of the fields the must be escaped with the carot character.
- ^;
- ^,
For example key/value pairs see the Workplace Shell objects:
- WPColorPalette
- WPDisk
- WPFolder
- WPFontPalette
- WPKeyboard
- WPLaunchPad
- WPPalette
- WPPrinter
- WPRPrinter
- WPProgram
- WPProgramFile
- WPSchemePalette
- WPShadow
- WPObject
All parameters have safe defaults. It is not necessary to pass unnecessary parameters to an object.