Subclassing is a technique to concuest the window procedure and process the messages by your own window procedure. When subclassing note that you can ONLY subclass windows from same thread.
The new window procedure STILL has to stand in the WindowProc callback function demands!
WNDPROC lpfnOldWndProc;
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { . switch(uMsg) { case ...: return(0); } . . // Call the original window procedure with the unprocessed messages return(CallWindowProc((WNDPROC)lpfnOldWndProc, hWnd, uMsg, wParam, lParam)); }
// Initialize lpfnOldWndProc = (WNDPROC)SetWindowLong(hEdit, GWL_WNDPROC, (DWORD)EditProc); SetWindowLong(hEdit, GWL_WNDPROC, (DWORD)EditProc);
// Destroy: SetWindowLong(hEdit, GWL_WNDPROC, (DWORD)lpfnOldWndProc); |