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 passes the message to OldWndProc, in the following manner:
CallWindowProc(OldWndProc, hwnd, wMessage, 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.