I want to invalidate the window when it’s created. How can I do that? calling InvalidateRect during WM_CREATE doesn’t work.
The thing is I call SetWindowLongPtr in WM_CREATE and set GWLP_USERDATA. WM_PAINT looks for some pointer in USER_DATA but the first time I receive WM_PAINT the data isn’t apparently still there so it doenst paint my stuff.
Also tried this:
#define MyDefinedMsg (WM_APP+1) //...// case WM_CREATE: //...// SetWindowLongPtr(hWnd,GWLP_USERDATA,ptr); PostMessage(hWnd,MyDefinedMsg,0,0); break; case MyDefinedMsg: InvalidateRect(hWnd,NULL,TRUE); break;
but did not work.
Thanks in advance
WM_CREATE/WM_SIZE/WM_PAINTetc).If your painting is failing due to GWLP_USERDATA being NULL then something else is happening…