Alternative way to create a custom control This takes more code to produce than the CStatic-derived custom control. So far, no advantages have yet been noticed with this approach. 1. Add a new class derived from generic CWnd. For base class, scroll to the very bottom to find generic CWnd. This will be our custom control class. 2. Add a member function called RegisterMe() to your custom control. Replace YourCustomCtrl with the name of your custom control. BOOL YourCustomCtrl::RegisterMe() { WNDCLASS wc; wc.style = 0; wc.lpfnWndProc = ::DefWindowProc; // must be this value wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = (HINSTANCE)::GetModuleHandle(NULL); wc.hIcon = NULL; // child window has no icon wc.hCursor = NULL; // we use OnSetCursor wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wc.lpszMenuName = NULL; // no menu wc.lpszClassName = "YourCustomCtrl"; return AfxRegisterClass(&wc); } 3. Call RegisterMe() once and only once. Hint: make RegisterMe() a static function. Then create a static BOOL variable and then call RegisterMe() like so. BOOL MyCustom2::hasClass = MyCustom2::RegisterMe(); 4. Add message map for WM_PAINT. 5. Add message map for WM_ERASEBKGND. 6. In OnPaint() paint your custom control a solid color.