You are passing an
ANSI string to he
AfxMessageBox
function, but that function require an
ANSI or
UNICODE string depending on your project settings.
Simply change the line:
AfxMessageBox("Fail to convert grayscale");
to:
AfxMessageBox(_T("Fail to convert grayscale"));
Note that the macro
_T(x)
gets a string and, if your project use the
MBCS charset lets the string unmodified otherwise, if your project use the
UNICODE charset the macro add a
L
before the string (e.g.
L"my string"
) that means
wide-char string