Well, think about it. You have a CreateWindowEx() call to create the edit control. Before that call returns and the HWND of the edit control is assigned to whatever variable you have assigned to capture it, the WM_CREATE handler code within the system dlls will execute. So only after the internal WM_CREATE returns, will the HWND be assigned to your variable. At that point you call SetWindowLong() to subclass the control, but at that point the WM_CREATE message is long gone.