There is no ANSI or Unicode variant of a numeric resource ID. The code that you use to set lpszIcon
is correct. It is idiomatic to use the MAKEINTRESOURCE
macro rather than a cast, but the cast has identical meaning. Your problem lies in the other code, the code that we cannot see.
Reading between the lines, I think that you are targeting ANSI or MBCS. You tried to use MAKEINTRESOURCE
but that expands to MAKEINTRESOURCEA
. That's what led you to cast. You should have used MAKEINTRESOURCEW
to match MSGBOXPARAMSW
. That would have resolved the compilation error you encountered. You could equally have changed the project to target UNICODE.
But none of that explains why the icon does not appear in the dialog. There has to be a problem elsewhere. If the dialog appears then the most likely explanation is that you have set hInstance
to a value other than NULL
. But the code to set lpszIcon
is correct, albeit not idiomatic.