The message comes from calling FormatMessage
with the HRESULT 0x800401F3. FormatMessage adds a line ending at the end of the message.
I found this...
Code: Select all
if (buf[size-1] == '\n')
buf[--size] = '\0';
// probably also has '\r', but doesn't seem necessary to remove it.
I think it's strange that the author of this code would bother to remove \n but leave \r, although I think it's probably because the \r on its own is invisible in a MsgBox. Maybe I'll change it.
You should extract the error code and compare that, not the message. I think that the message depends on your system's UI language.