What is intended way to use UNICODE-macro-dependent RC_* macros in UNICODE-independent code?

  • Thread starter Thread starter MikeKaganski
  • Start date Start date
M

MikeKaganski

Guest
The MAKEINTRESOURCE define is UNICODE-dependent, and resolves to either MAKEINTRESOURCEW or MAKEINTRESOURCEA.

Some standard defines in WinUser.h, e.g. pre-defined resource types (RT_RCDATA), standard cursors (IDC_ARROW) and icons (IDI_APPLICATION), are defined using the MAKEINTRESOURCE, which makes those standard defined also UNICODE-dependent.

When using the resource API in a not-UNICODE-dependent way (e.g., FindResourceW instead of FindResource macro), what is the intended way to use those standard resource identifiers?

E.g., code like this:

HRSRC hrc = FindResourceW(g_hModule, L"#2000", RT_RCDATA);

would only succeed with UNICODE defined, but fail when it is not, because of type mismatch. There's no RT_RCDATAW available. Is it expected to use strange constructs like

HRSRC hrc = FindResourceW(g_hModule, L"#2000", MAKEINTRESOURCEW(RT_RCDATA));

or is there some other nicer intended way? (Of course, there are multiple ways to cast explicitly; I'm talking about the original intention here.)


Best regards, Mike Kaganski

Continue reading...
 
Back
Top