Buggy code:
LRESULT WM_MOUSEHOVER ( int wParam , int lParam ) { } LRESULT WM_MOUSELEAVE ( int wParam , int lParam ) { } LRESULT WM_MOUSEMOVE ( int wParam , int lParam ) { } LRESULT WM_MOUSEWHEEL ( int wParam , int lParam ) { } LRESULT WM_MOVE ( int wParam , int lParam ) { } LRESULT WM_NCACTIVATE ( int wParam , int lParam ) { } LRESULT WM_NCCALCSIZE ( int wParam , int lParam ) { } LRESULT WM_NCHITTEST ( int wParam , int lParam ) { } LRESULT WM_NCLBUTTONDOWN ( int wParam , int lParam ) { } LRESULT WM_NCPAINT ( int wParam , int lParam ) { } LRESULT WM_NOTIFY ( int wParam , int lParam ) { } LRESULT WM_PAINT ( int wParam , int lParam ) { } LRESULT WM_PALETTECHANGED ( int wParam , int lParam ) { } LRESULT WM_PARENTNOTIFY ( int wParam , int lParam ) { } LRESULT WM_PASTE ( int wParam , int lParam ) { } LRESULT WM_PRINT ( int wParam , int lParam ) { } LRESULT WM_PRINTCLIENT ( int wParam , int lParam ) { } LRESULT WM_QUERYENDSESSION ( int wParam , int lParam ) { } LRESULT WM_QUERYNEWPALETTE ( int wParam , int lParam ) { } LRESULT WM_QUERYOPEN ( int wParam , int lParam ) { } LRESULT WM_RBUTTONDBLCLK ( int wParam , int lParam ) { } LRESULT WM_RBUTTONDOWN ( int wParam , int lParam ) { } LRESULT WM_RBUTTONUP ( int wParam , int lParam ) { } LRESULT WM_SETCURSOR ( int wParam , int lParam ) { } LRESULT WM_SETFOCUS ( int wParam , int lParam ) { } LRESULT WM_SETTINGCHANGE ( int wParam , int lParam ) { } LRESULT WM_SETFONT ( int wParam , int lParam ) { } LRESULT WM_SETREDRAW ( int wParam , int lParam ) { } LRESULT WM_SHOWWINDOW ( int wParam , int lParam ) { } LRESULT WM_SIZE ( int wParam , int lParam ) { } LRESULT WM_SYSCHAR ( int wParam , int lParam ) { } LRESULT WM_SYSCOLORCHANGE ( int wParam , int lParam ) { } LRESULT WM_SYSCOMMAND ( int wParam , int lParam ) { } LRESULT WM_SYSKEYDOWN ( int wParam , int lParam ) { } LRESULT WM_SYSKEYUP ( int wParam , int lParam ) { } LRESULT WM_TIMER ( int wParam , int lParam ) { } LRESULT WM_UNDO ( int wParam , int lParam ) { } LRESULT WM_UPDATEUISTATE ( int wParam , int lParam ) { } LRESULT WM_VSCROLL ( int wParam , int lParam ) { } LRESULT WM_WINDOWPOSCHANGED ( int wParam , int lParam ) { } LRESULT WM_WINDOWPOSCHANGING ( int wParam , int lParam ) { } LRESULT WM_XBUTTONDBLCLK ( int wParam , int lParam ) { } LRESULT WM_XBUTTONDOWN ( int wParam , int lParam ) { } LRESULT WM_XBUTTONUP ( int wParam , int lParam ) { } LRESULT wmColorChild ( int wParam , int lParam ) { Control control = findBackgroundControl ( ) ; if ( control == null ) { if ( ( ( state ) & ( THEME_BACKGROUND ) ) != 0 ) { if ( ( ( OS . COMCTL32_MAJOR ) >= 6 ) && ( OS . IsAppThemed ( ) ) ) { control = findThemeControl ( ) ; if ( control != null ) { RECT rect = new RECT ( ) ; OS . GetClientRect ( handle , rect ) ; OS . SetTextColor ( wParam , getForegroundPixel ( ) ) ; OS . SetBkColor ( wParam , getBackgroundPixel ( ) ) ; fillThemeBackground ( wParam , control , rect ) ; OS . SetBkMode ( wParam , TRANSPARENT ) ; return new LRESULT ( OS . GetStockObject ( NULL_BRUSH ) ) ; } } } if ( ( foreground ) == ( - 1 ) ) return null ; } if ( control == null ) control = this ; <START_BUG> int forePixel = control . getForegroundPixel ( ) ; <END_BUG> int backPixel = control . getBackgroundPixel ( ) ; OS . SetTextColor ( wParam , forePixel ) ; OS . SetBkColor ( wParam , backPixel ) ; if ( ( control . backgroundImage ) != null ) { RECT rect = new RECT ( ) ; OS . GetClientRect ( handle , rect ) ; int hwnd = control . handle ; int hBitmap = control . backgroundImage . handle ; OS . MapWindowPoints ( handle , hwnd , rect , 2 ) ; POINT lpPoint = new POINT ( ) ; OS . GetWindowOrgEx ( wParam , lpPoint ) ; OS . SetBrushOrgEx ( wParam , ( ( - ( rect . left ) ) - ( lpPoint . x ) ) , ( ( - ( rect . top ) ) - ( lpPoint . y ) ) , lpPoint ) ; int hBrush = findBrush ( hBitmap , BS_PATTERN ) ; if ( ( ( state ) & ( DRAW_BACKGROUND ) ) != 0 ) { int hOldBrush = OS . SelectObject ( wParam , hBrush ) ; OS . MapWindowPoints ( hwnd , handle , rect , 2 ) ; OS . PatBlt ( wParam , rect . left , rect . top , ( ( rect . right ) - ( rect . left ) ) , ( ( rect . bottom ) - ( rect . top ) ) , PATCOPY ) ; OS . SelectObject ( wParam , hOldBrush ) ; } OS . SetBkMode ( wParam , TRANSPARENT ) ; return new LRESULT ( hBrush ) ; } return new LRESULT ( findBrush ( backPixel , BS_SOLID ) ) ; } LRESULT wmCommandChild ( int wParam , int lParam ) { } LRESULT wmDrawChild ( int wParam , int lParam ) { } LRESULT wmMeasureChild ( int wParam , int lParam ) { } LRESULT wmNotifyChild ( int wParam , int lParam ) { } LRESULT wmScrollChild ( int wParam , int lParam ) { } }

Fix:
int forePixel = getForegroundPixel ( ) ;