Platform SDK: International Features |
Subclassing is a technique that allows an application to intercept and process messages sent or posted to a particular window before the window has a chance to process them. The system automatically translates messages into ANSI or Unicode form, depending on the form of the function that subclassed the window procedure.
The following call to the SetWindowLongA function subclasses the current window procedure associated with the window identified by the hwnd parameter. The new window procedure, NewWndProc
, will receive messages with text in ANSI format.
OldWndProc = (WNDPROC) SetWindowLongA(hwnd, GWL_WNDPROC, (LONG)NewWndProc);
When NewWndProc
has finished processing a message, it uses the CallWindowProc function as follows to pass the message to OldWndProc
.
CallWindowProc(OldWndProc, hwnd, uMessage, wParam, lParam);
If OldWndProc
was created with a class style of UNICODE, messages will be translated from the ANSI form received by NewWndProc
into Unicode.
Similarly, a call to the SetWindowLongW function would subclass the current window procedure with a window procedure that expects Unicode text messages. Message translation, if necessary, is performed during the processing of the CallWindowProc function.
For more information about subclassing, see Window Procedures.