MessageBox is not the right solution to paint problems as after the message box you will have paint again giving you endless message box to control. Use OutputDebugString or some log to a file.