Oh right, well done.
EDIT: if you don't have fLoad = TRUE the temp bmp is not saved and there can't be any UNDO.
Your MessageBox's are called numerous times because it interferes with WM_PAINT,
If you only use
case WM_PAINT:
{
char s[90];
static int cnt = 0;
cnt++;
sprintf(s, "%d", cnt);
SetWindowText(hwnd, s);
then all is ok.
Anyway a couple of W_PAINTs is not a problem.
John