Precompiler replacements

Hello,

I am facing the following situation. In my code at a point I need to declare a std::wstring and compare it with a text "MessageBox" read from a file. e.g

if (filetext == L"MessageBox")
{
do something...
}

My problem is that the word MessageBox is defined as MessageBoxW in windows.h (I think) and the precompiler replaces the string with MessageBoxW. So I actually compare my text with MessageBoxW.

Is there any solution/trick to override this problem or do I have to change the text I use?

Thanks!
Last edited on
For Unicode, use std::wstring instead.

Sorry but i already use std::wstring (was writen false).
The code i use is:
#define IMPROVED_ENUM_NAME Flags
#define IMPROVED_ENUM_LIST ENUMITEM_VALUE(Log, 1) \
ENUMITEM_VALUE(ErrorLog, 2) \
ENUMITEM_VALUE(BoxMessage, 4) \
ENUMITEM_VALUE(TextMessage, 8) \
ENUMITEM_VALUE(Acknowledge, 16) \
ENUMITEM_VALUE(Reset, 32)
#include "defineImprovedEnum.h"

with "BoxMessage" instead of "MessageBox" works fine. Otherwise precompiler this that owns "MessageBox" and replace it with MessageBoxW because the Character Set is for unicode.
Last edited on
Topic archived. No new replies allowed.