Jump to content

wpQueryHandleFromContents

From EDM2
Revision as of 02:35, 25 November 2025 by Martini (talk | contribs) (Created page with "{{DISPLAYTITLE:wpQueryHandleFromContents}} This method is specific to Version 4, or higher, of the OS/2 operating system. This instance method returns a handle to a known system data type based on a file's contents. This is an abstract method; subclasses that describe files for which a system handle type exist (such as WPIcon or WPBitmap) should subclass this method. ==Syntax== _wpQueryHandleFromContents(somSelf) ==Parameters== ;''somSelf'' (WPDataFile *)...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This method is specific to Version 4, or higher, of the OS/2 operating system.

This instance method returns a handle to a known system data type based on a file's contents. This is an abstract method; subclasses that describe files for which a system handle type exist (such as WPIcon or WPBitmap) should subclass this method.

Syntax

_wpQueryHandleFromContents(somSelf)

Parameters

somSelf (WPDataFile *) - input
Pointer to the object on which the method is being invoked.
Points to an object of class WPDataFile.

Returns

handle (LHANDLE) - returns
Handle to the data type object (or **NULLHANDLE** if call is unsuccessful).

How to Override

This method should be overridden in any subclass of WPDataFile that can represent its data with a handle.

Usage

This method can be called at any time to obtain a handle that represents the data in the data file corresponding to this data file object.

Remarks

The handle returned by this method is data type specific. For example, an Image File object will return a handle to a bitmap (that is, an **HBITMAP**), while an Icon or Pointer might return a handle to a pointer (such as an **HPOINTER**).

Example Code

#define INCL_WINWORKPLACE
#include <os2.h>

WPDataFile *somSelf; /* Pointer to the object on which the method is being invoked. */
LHANDLE handle; /* Handle to the data type object (or NULLHANDLE if call is unsuccessful). */

handle = _wpQueryHandleFromContents(somSelf);

/* Example code from the Image File class: */
SOM_Scope LHANDLE SOMLINK img_wpQueryHandleFromContents(WPImageFile
*somSelf)
{
    HBITMAP hBitmap = NULLHANDLE;

    _wpQueryBitmapHandle(somSelf,&hBitmap,NULL,0,0,0,RGB_BLACK,NULL);
    return hBitmap;
}

Related Methods