WpQueryHandle: Difference between revisions
Created page with "{{DISPLAYTITLE:wpQueryHandle}} This instance method returns a unique, persistent object handle for the given object. ==Syntax== _wpQueryHandle(somSelf); ==Parameters== ;''somSelf'' (WPObject *) - input :Pointer to the object on which the method is being invoked. :Points to an object of class WPObject. ==Returns== ;''hObject'' (HOBJECT) - returns :Persistent handle for the given object. :The high word of this handle is filled out by WPObject to identify th..." |
mNo edit summary |
||
| Line 3: | Line 3: | ||
==Syntax== | ==Syntax== | ||
_wpQueryHandle(somSelf) | _wpQueryHandle(somSelf) | ||
==Parameters== | ==Parameters== | ||
;''somSelf'' ([[WPObject]] *) - input | ;''somSelf'' ([[WPObject]] *) - input:Pointer to the object on which the method is being invoked. | ||
:Pointer to the object on which the method is being invoked. | |||
:Points to an object of class WPObject. | :Points to an object of class WPObject. | ||
==Returns== | ==Returns== | ||
;''hObject'' ([[HOBJECT]]) - returns | ;''hObject'' ([[HOBJECT]]) - returns:Persistent handle for the given object. | ||
:Persistent handle for the given object. | :The high word of this handle is filled out by ''WPObject'' to identify the base class. The low word is filled out by the base class to allow it to locate the object. | ||
:The high word of this handle is filled out by | |||
==Remarks== | ==Remarks== | ||
| Line 19: | Line 17: | ||
'''Note:''' It is recommended that **wpQueryHandle** be used sparingly on file-based object classes because the operating system keeps track of the current location of every file object that has been allocated an object handle. Performance could be adversely affected if object handles are obtained for every file-system object that was ever awakened. | '''Note:''' It is recommended that **wpQueryHandle** be used sparingly on file-based object classes because the operating system keeps track of the current location of every file object that has been allocated an object handle. Performance could be adversely affected if object handles are obtained for every file-system object that was ever awakened. | ||
Using | Using HOBJECT for .INI files or files in which an application uses a rename/save/delete sequence is not supported. | ||
==Usage== | ==Usage== | ||
| Line 28: | Line 26: | ||
==Example Code== | ==Example Code== | ||
Declaration: | Declaration: | ||
<PRE> | <PRE> | ||
#define INCL_WINWORKPLACE | #define INCL_WINWORKPLACE | ||
Latest revision as of 16:56, 26 October 2025
This instance method returns a unique, persistent object handle for the given object.
Syntax
_wpQueryHandle(somSelf)
Parameters
- somSelf (WPObject *) - input
- Pointer to the object on which the method is being invoked.
- Points to an object of class WPObject.
Returns
- hObject (HOBJECT) - returns
- Persistent handle for the given object.
- The high word of this handle is filled out by WPObject to identify the base class. The low word is filled out by the base class to allow it to locate the object.
Remarks
The object handle returned from this method is the same handle that can either be used for the WinCreateObject, WinSetObjectData or WinDestroyObject. The handle is unique on a given machine so the returned object handle can be passed to other processes or stored for later use (even across IPLs of the system). For more information about WinCreateObject, WinSetObjectData, and WinDestroyObject, see the Presentation Manager Programming Reference. Note: It is recommended that **wpQueryHandle** be used sparingly on file-based object classes because the operating system keeps track of the current location of every file object that has been allocated an object handle. Performance could be adversely affected if object handles are obtained for every file-system object that was ever awakened.
Using HOBJECT for .INI files or files in which an application uses a rename/save/delete sequence is not supported.
Usage
This method can be called at any time to get a handle that is both persistent across IPLs and completely unique on the given machine.
How to Override
This method is generally not overridden.
Example Code
Declaration:
#define INCL_WINWORKPLACE #include <os2.h> WPObject *somSelf; /* Pointer to the object on which the method is being invoked. */ HOBJECT hObject; /* Persistent handle for the given object. */ hObject = _wpQueryHandle(somSelf);