본문 바로가기
나머지/IT개발.잡다한것.

MessageBox 에서 에러남 @ 비쥬얼 스튜디오 2010

by 무늬만학생 2012. 9. 12.
반응형

원인은 유니코드 


에러메시지 

이거랑 비슷함 


error C2664: 'CWnd::MessageBoxW' : cannot convert parameter 1 from 'const char [48]' to 'LPCTSTR'

Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast]

------------------------------------------------------------------------------------------------


This error message usually appears in case of Unicode applications. 

You can put a L before your string: L"Hello...", but the better solution is to use _T macro: 

MessageBox(_T("Hello. This is my first Visual C++ Application!")); 

Now your program can be compiled in both Unicode and ANSI modes. You have to use such macro for almost all of your strings.

 The current mode can be selected in Project Properties --> General --> Character Set.

------------------------------------------------------------------------------------------------

MessageBox(_T("Hello. This is my first Visual C++ Application!"));

or:

 MessageBox(L"Hello. This is my first Visual C++ Application!");

VS2005 creates Unicode application by default.


출처 : http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/d1065aaa-4641-4028-bdfa-44dcb56919bc


ㅇㅣ건 에러난 소스 ㅋ 

#include <windows.h>



int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,

                    LPSTR szCmdLine, int iCmdShow)

{



     MessageBox (NULL, "ㅇㅇㅇ", "ㅇㅇㅇ", 0) ;


     return 0 ; 

}



추가

속성창에서 Multi-Byte 문자집합 사용으로 바꿔도 된다. 



반응형

'나머지 > IT개발.잡다한것.' 카테고리의 다른 글

visual studio 6.0 을 안쓰는이유  (2) 2012.09.13
win API 캐럿 Caret  (0) 2012.09.13
비쥬얼 C 버전  (0) 2012.09.11
C언어 영상처리 라이브러리  (0) 2012.09.11
비쥬얼 C 버전(2)  (0) 2012.09.10