- editor->hWnd may be NULL for windowless richedit controls, but you
code doesn't seem to take that into consideration. 2. The style flags that you get from GetWindowLongW should probably come from the cached values in editor->styleFlags.
The main reason why GetWindowLongW is used there is that editor->styleFlags actually isn't window style and doesn't contain ES_WANTRETURN. What's the proper way to get actually window style in this case?