CB 2009+ 부터는 Unicode-based Win32 API functions을 사용하기에 아래와 같이 바꿔야 한다고 하네요... ㅜ.ㅜ
The old Application->MessageBox did not compile it gives the error :
Cannot convert 'char *' to 'const wchar_t *'
TApplication::MessageBox() is just a thin wrapper around the Win32 API MessageBox()
function. For whatever reason, Borland decided to make the data types of
the TApplication::MessageBox() parameters match the data types of the Win32
API MessageBox() parameters, instead of using RTL equivilents like other
RTL wrappers do. In BCB v6, the RTL/VCL uses Ansi-based Win32 API functions,
thus MessageBoxA() is used and so the TApplication::MessageBox() parameters
are char*. In CB 2009+, the RTL/VCL uses Unicode-based Win32 API functions,
thus MessageBoxW() is used and the TApplication::MessageBox() parameters
are wchar_t*. Because of that, you have to update your code accordingly, eg:
int res = Application->MessageBox(L"My Text", L"My Caption", MB_YESNO | MB_ICONEXCLAMATION | MB_DEFBUTTON2);
int res = Application->MessageBox(L"My Text", L"My Caption", MB_OK | MB_ICONEXCLAMATION);
아래는 원문입니다.
https://forums.embarcadero.com/thread.jspa?threadID=85183
nervegum 님이 쓰신 글 :
: MessageBox를 사용하는데
: 예전에 사용했던 방법은
: Application->MessageBox("내용","캡션",MB_OKCANCEL);
: 로 사용을 했습니다.
:
: 하지만 이번에 XE2에서 컴파일을 하니까 형변환 에러가 나옵니다.
:
: Cannot convert 'char const[8]' to 'const wchar_t *'
: Type mismatch in parameter 'Caption' (wanted 'const wchar_t *', got 'const char *')
:
:
: 구굴링 하다가 찾은 방법은
: 아래와 같습니다.
:
:
: void __fastcall TForm1::Button1Click(TObject *Sender)
: {
: Application->NormalizeTopMosts();
: #ifdef _DELPHI_STRING_UNICODE
: Application->MessageBox(L"This should be on top.", L"Look", MB_OKCANCEL);
: #else
: Application->MessageBox("This should be on top.", "Look", MB_OKCANCEL);
: #endif
: Application->RestoreTopMosts();
: }
:
:
: 질문입니다.
: 1. MessageBoX를 사용할때는 L + "메시지"를 해야 되는 것인가요?
: 어딘가에 정의가 되있는것 같은데 혹시 컴파일 옵션처리로 예전처럼 사용할 수 없는 것인가요?
:
: 감사합니다.