Well, so far I have always encoded GCC, so I am new to MSVC ++ (and these are errors). I compiled a minimal Win Api program with GDI plus. It compiles fine, but closes with an error at runtime almost immediately after it starts (I think a runtime error occurs when the WM_PAINT message is called). Here is what I see: 
My code doesn't represent anything, it just displays a rectangle. (It works great when I do this with GDI, but does not work with GDI +).
My code is:
HDC hdc = GetDC(hwnd); InvalidateRect(hwnd,NULL,FALSE); ULONG_PTR token; GdiplusStartupInput inp; GdiplusStartup(&token,&inp,0); Graphics g(hdc); g.Clear(Color(0,0,0)); g.DrawRectangle(new Pen(Color(0,0,0)),10,10,100,100); GdiplusShutdown(token); ValidateRect(hwnd,NULL);
Debugging I found that a runtime error appears almost immediately after calling the Graphics g(hdc); constructor Graphics g(hdc); . I can not find anything on Google etc. I am completely lost. Any help?
source share