Jump to content

WinCreateObject: Difference between revisions

From EDM2
WinCreateObject created.
 
No edit summary
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== 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.
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 ===
==Syntax==
; className - [[OS2 API:DataType:PSZ|PSZ]] - input :
WinCreateObject (className, titleOfObject, setupString, location, creationFlags)
Class name of object.
 
; titleOfObject - [[OS2 API:DataType:PSZ|PSZ]] - input :
==Parameters==
The title to appear, when displayed, underneath an icon or in the titlebar, of the open object.
;className - [[PSZ]] - input : Class name of object.
; setupString - [[OS2 API:DataType:PSZ|PSZ]] - input :
;titleOfObject - PSZ - input : The title to appear, when displayed, underneath an icon or in the titlebar, of the open object.
See the description for the Workplace [[OS2_API:WPLaunchPad|WPLaunchPad]] for a table of setup strings to customize the Toolbar.
;setupString - PSZ - input : See the description for the Workplace [[WPLaunchPad]] for a table of setup strings to customize the Toolbar.
; location - [[OS2 API:DataType:PSZ|PSZ]] - input :
;location - PSZ - input : The value can be in the following formats:
The value can be in the following formats:


Any predefined system folder object ids:
Any predefined system folder object ids:
Line 24: Line 21:


The real name as a fully qualified path name.
The real name as a fully qualified path name.
; creationFlags - [[OS2 API:DataType:ULONG|ULONG]] - input :
;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.
*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.


* [[OS2 API:Constant:CO#CO_REPLACEIFEXISTS|CO_REPLACEIFEXISTS]] - If an object with the given ID already exists, the existing object should be replaced.
== Constants ==
See [[#Parameters|the paramters]] section.


* [[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.
== Returns ==
[[APIRET]] with values of:
* [[HOBJECT]] - Handle to created object.
* [[NULLHANDLE]] - Object creation failed.


=== Constants ===
== Define (C/C++) ==
See [[OS2 API:WinCreateObject#Parameters|the paramters]] section.
 
=== Returns ===
[[OS2 API:DataType:APIRET|APIRET]] with values of:
* [[OS2 API:DataType:HOBJECT|HOBJECT]] - Handle to created object.
* [[OS2 API:DataType:NULLHANDLE|NULLHANDLE]] - Object creation failed.
 
=== Module ===
 
=== Define (C/C++) ===
INCL_WINWORKPLACE
INCL_WINWORKPLACE


=== Export name/Ordinal ===
== Calling Convention ==
 
=== Calling conversion ===
[[Cdecl32]]
[[Cdecl32]]


=== Example Code ===
== Example Code ==
  [[OS2 API:DataType:PSZ|PSZ]]   className;
  PSZ    className;
  [[OS2 API:DataType:PSZ|PSZ]]   titleOfObject;
  PSZ    titleOfObject;
  [[OS2 API:DataType:PSZ|PSZ]]   setupString;
  PSZ    setupString;
  [[OS2 API:DataType:PSZ|PSZ]]   location;
  PSZ    location;
  [[OS2 API:DataType:ULONG|ULONG]] creationFlags;
  ULONG  creationFlags;
  [[OS2 API:DataType:APIRET|APIRET]] rc;
  APIRET rc;
  ...
  ...
  rc = WinCreateObject(className, titleOfObject, setupString, location, creationFlags);
  rc = WinCreateObject(className, titleOfObject, setupString, location, creationFlags);
  ...
  ...


=== Related Functions ===
== Related Functions ==
[[OS2 API:WinDeregisterObjectClass|WinDeregisterObjectClass]]
*[[WinDeregisterObjectClass]]
[[OS2 API:WinDestroyObject|WinDestroyObject]]
*[[WinDestroyObject]]
[[OS2 API:WinRegisterObjectClass|WinRegisterObjectClass]]
*[[WinRegisterObjectClass]]
[[OS2 API:WinReplaceObjectClass|WinReplaceObjectClass]]
*[[WinReplaceObjectClass]]
[[OS2 API:WinSetObjectData|WinSetObjectData]]
*[[WinSetObjectData]]


=== Notes ===
== 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,
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"
  "key1=value1,value2,value3;key2=value1;key3=value1,value2;key4=value1"
Line 77: Line 68:


For example key/value pairs see the Workplace Shell objects:
For example key/value pairs see the Workplace Shell objects:
* [[OS2 API:WPColorPalette|WPColorPalette]]
*[[WPColorPalette]]
* [[OS2 API:WPDisk|WPDisk]]
*[[WPDisk]]
* [[OS2 API:WPFolder|WPFolder]]
*[[WPFolder]]
* [[OS2 API:WPFontPalette|WPFontPalette]]
*WPFontPalette
* [[OS2 API:WPKeyboard|WPKeyboard]]
*[[WPKeyboard]]
* [[OS2 API:WPLaunchPad|WPLaunchPad]]
*[[WPLaunchPad]]
* [[OS2 API:WPPalette|WPPalette]]
*[[WPPalette]]
* [[OS2 API:WPPrinter|WPPrinter]]
*[[WPPrinter]]
* [[OS2 API:WPRPrinter|WPRPrinter]]
*[[WPRPrinter]]
* [[OS2 API:WPProgram|WPProgram]]
*WPProgram
* [[OS2 API:WPProgramFile|WPProgramFile]]
*WPProgramFile
* [[OS2 API:WPSchemePalette|WPSchemePalette]]
*WPSchemePalette
* [[OS2 API:WPShadow|WPShadow]]
*WPShadow
* [[OS2 API:WPObject|WPObject]]
*[[WPObject]]


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.


=== OS Version Introduced ===
[[Category:Win]]

Latest revision as of 04:49, 20 May 2018

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.

Syntax

WinCreateObject (className, titleOfObject, setupString, location, creationFlags)

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:

Define (C/C++)

INCL_WINWORKPLACE

Calling Convention

Cdecl32

Example Code

PSZ    className;
PSZ    titleOfObject;
PSZ    setupString;
PSZ    location;
ULONG  creationFlags;
APIRET rc;
...
rc = WinCreateObject(className, titleOfObject, setupString, location, creationFlags);
...

Related Functions

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:

All parameters have safe defaults. It is not necessary to pass unnecessary parameters to an object.