Jump to content

WinSetClassThunkProc: Difference between revisions

From EDM2
Created page with "This function associates a pointer-conversion procedure with a window class. ==Syntax== WinSetClassThunkProc(pszClassName, pfnThunkProc) ==Parameters== ;''pszClassName'' (..."
 
Ak120 (talk | contribs)
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
This function associates a pointer-conversion procedure with a window class.  
This function associates a pointer-conversion procedure with a window class.


==Syntax==
==Syntax==
Line 5: Line 5:


==Parameters==
==Parameters==
;''pszClassName'' (PSZ) - input
;''pszClassName'' (PSZ) - input:Window-class name.
: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.


;''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==
==Returns==
;rc (BOOL) - returns
;rc (BOOL) - returns:Success indicator.
:Success indicator.
:;TRUE:Successful completion  
:;TRUE
:;FALSE:An error occurred.
::Successful completion  
:;FALSE
::An error occurred.


==Remarks==
==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.  
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==
==Example Code==
Line 31: Line 24:
#define INCL_WINWINDOWMGR
#define INCL_WINWINDOWMGR
#define INCL_WINTHUNKAPI
#define INCL_WINTHUNKAPI
#include <OS2.H>
#include <os2.h>


LONG thunkpr(LONG *p);  /* prototype definition. */
LONG thunkpr(LONG *p);  /* prototype definition. */
Line 53: Line 46:
/* 16-bit to 32-bit pointer conversion procedure. */
/* 16-bit to 32-bit pointer conversion procedure. */
}
}
</pre>
</pre>
Definition
Definition
Line 72: Line 64:
* [[WinQueryWindowThunkProc]]
* [[WinQueryWindowThunkProc]]
* [[WinSetWindowThunkProc]]
* [[WinSetWindowThunkProc]]
[[Category:Win]]
[[Category:Win]]

Latest revision as of 20:42, 27 November 2023

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