Jump to content

WinSetClassThunkProc

From EDM2
Revision as of 20:42, 27 November 2023 by Ak120 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function associates a pointer-conversion procedure with a window class.

Syntax

WinSetClassThunkProc(pszClassName, pfnThunkProc)

Parameters

pszClassName (PSZ) - input
Window-class name.
pfnThunkProc (PFN) - input
Pointer-conversion procedure identifier.
NULL
Any existing pointer-conversion procedure is dissociated from this class.
By default, a class has no pointer-conversion procedure associated with it.
Other
The pointer-conversion procedure to be associated with this class.

Returns

rc (BOOL) - returns
Success indicator.
TRUE
Successful completion
FALSE
An error occurred.

Remarks

This function does not alter the pointer-conversion procedure associated with any existing window. It changes the pointer-conversion procedure that will be associated with a window created with a subsequent WinCreateWindow or WinCreateStdWindow function.

Example Code

This example sets the pointer conversion procedure of the window class, given that we have an anchor-block handle.

#define INCL_WINWINDOWMGR
#define INCL_WINTHUNKAPI
#include <os2.h>

LONG thunkpr(LONG *p);  /* prototype definition. */
main()
{
HAB hab;
PFN pfn;
char *classname;

WinQueryClassName(hab,
                  sizeof(classname),
                  classname);

WinSetClassThunkProc(classname,
                     (PFN)thunkpr);

}

LONG thunkpr(LONG *p)
{
/* 16-bit to 32-bit pointer conversion procedure. */
}

Definition

#define INCL_WINTHUNKAPI /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>

PSZ     pszClassName;  /*  Window-class name. */
PFN     pfnThunkProc;  /*  Pointer-conversion procedure identifier. */
BOOL    rc;            /*  Success indicator. */

rc = WinSetClassThunkProc(pszClassName, pfnThunkProc);

Related Functions