모바일 오유 바로가기
http://m.todayhumor.co.kr
분류 게시판
베스트
  • 베스트오브베스트
  • 베스트
  • 오늘의베스트
  • 유머
  • 유머자료
  • 유머글
  • 이야기
  • 자유
  • 고민
  • 연애
  • 결혼생활
  • 좋은글
  • 자랑
  • 공포
  • 멘붕
  • 사이다
  • 군대
  • 밀리터리
  • 미스터리
  • 술한잔
  • 오늘있잖아요
  • 투표인증
  • 새해
  • 이슈
  • 시사
  • 시사아카이브
  • 사회면
  • 사건사고
  • 생활
  • 패션
  • 패션착샷
  • 아동패션착샷
  • 뷰티
  • 인테리어
  • DIY
  • 요리
  • 커피&차
  • 육아
  • 법률
  • 동물
  • 지식
  • 취업정보
  • 식물
  • 다이어트
  • 의료
  • 영어
  • 맛집
  • 추천사이트
  • 해외직구
  • 취미
  • 사진
  • 사진강좌
  • 카메라
  • 만화
  • 애니메이션
  • 포니
  • 자전거
  • 자동차
  • 여행
  • 바이크
  • 민물낚시
  • 바다낚시
  • 장난감
  • 그림판
  • 학술
  • 경제
  • 역사
  • 예술
  • 과학
  • 철학
  • 심리학
  • 방송연예
  • 연예
  • 음악
  • 음악찾기
  • 악기
  • 음향기기
  • 영화
  • 다큐멘터리
  • 국내드라마
  • 해외드라마
  • 예능
  • 팟케스트
  • 방송프로그램
  • 무한도전
  • 더지니어스
  • 개그콘서트
  • 런닝맨
  • 나가수
  • 디지털
  • 컴퓨터
  • 프로그래머
  • IT
  • 안티바이러스
  • 애플
  • 안드로이드
  • 스마트폰
  • 윈도우폰
  • 심비안
  • 스포츠
  • 스포츠
  • 축구
  • 야구
  • 농구
  • 바둑
  • 야구팀
  • 삼성
  • 두산
  • NC
  • 넥센
  • 한화
  • SK
  • 기아
  • 롯데
  • LG
  • KT
  • 메이저리그
  • 일본프로야구리그
  • 게임1
  • 플래시게임
  • 게임토론방
  • 엑스박스
  • 플레이스테이션
  • 닌텐도
  • 모바일게임
  • 게임2
  • 던전앤파이터
  • 마비노기
  • 마비노기영웅전
  • 하스스톤
  • 히어로즈오브더스톰
  • gta5
  • 디아블로
  • 디아블로2
  • 피파온라인2
  • 피파온라인3
  • 워크래프트
  • 월드오브워크래프트
  • 밀리언아서
  • 월드오브탱크
  • 블레이드앤소울
  • 검은사막
  • 스타크래프트
  • 스타크래프트2
  • 베틀필드3
  • 마인크래프트
  • 데이즈
  • 문명
  • 서든어택
  • 테라
  • 아이온
  • 심시티5
  • 프리스타일풋볼
  • 스페셜포스
  • 사이퍼즈
  • 도타2
  • 메이플스토리1
  • 메이플스토리2
  • 오버워치
  • 오버워치그룹모집
  • 포켓몬고
  • 파이널판타지14
  • 배틀그라운드
  • 기타
  • 종교
  • 단어장
  • 자료창고
  • 운영
  • 공지사항
  • 오유운영
  • 게시판신청
  • 보류
  • 임시게시판
  • 메르스
  • 세월호
  • 원전사고
  • 2016리오올림픽
  • 2018평창올림픽
  • 코로나19
  • 2020도쿄올림픽
  • 게시판찾기
  • 오유인페이지
    개인차단 상태
    크고거대한거님의
    개인페이지입니다
    가입 : 11-12-09
    방문 : 2429회
    닉네임변경 이력
    회원차단
    회원차단해제
    게시물ID : programmer_12323
    작성자 : 비공감합디다
    추천 : 0
    조회수 : 7608
    IP : 153.191.***.126
    댓글 : 3개
    등록시간 : 2015/07/25 01:07:07
    http://todayhumor.com/?programmer_12323 모바일
    [반말주의] 비쥬얼스튜디오에서 유니코드로 에러날때..
    아래 니파님께서 <span style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:12.3428573608398px;">LPCTSTR 오류가 날때 왜 _T()를 하면 고쳐지나요에 대한 이야기를 예전에 블로그에 포스팅을 한적이 있어 여기에 적어봅니다.</span> <div><span style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:12.3428573608398px;">왠지 블로그를 직접적으면 광고..(달지도 않았지만)일것 같기도 하고 뭔가 부끄러운 이야기가 많이 있기때문에</span></div> <div><span style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:12.3428573608398px;">위의 질문에 대해 예전에 포스팅한 걸 여기에 적어 봅니다.</span></div> <div><span style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:12.3428573608398px;"><br></span></div> <div><span style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:12.3428573608398px;">혼자 글을 쓰는 블로그에 올린 것을 퍼오는 것이기때문에 높임말을 쓰지 않은것에대해 먼저 양해를 구합니다.</span></div> <div><br></div> <div><p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">이번학기에 비주얼프로그래밍 수업을 들으면서..(사실은 뭐 그의 MFC수업이었지만)</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">기초적인 WindowsAPI에 대해 '맛'을 봤었다.</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">사실, 이번학기시작전에 WINDOWS API책을 살짝 훑어보고 시작한지라 공부를 하지 않고도 그럭저럭 학점이 잘 나오리라 생각한다.</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">하지만, 수업을 듣던중가장 난감했던 것은. 바로 유니코드.</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">난 수업시간에 내노트북을 갖고 다니면서 프로그래밍을 했다.</p> <p style="margin:0in;"><span style="font-family:'Malgun Gothic';font-size:11pt;">하지만계속해서 </span><span style="font-family:'돋움';font-size:14pt;color:#e1dfdf;background:#5c5253;">유니코드</span><span style="font-family:'Malgun Gothic';font-size:11pt;">때문에 막혔다. 첫번째 시간은 </span><span style="text-decoration:underline;font-family:'돋움';font-size:8.25pt;color:#e1dfdf;background:#5c5253;">코드를그대로 쳤으나 코드가 돌아가지 않았다</span><span style="font-family:'Malgun Gothic';font-size:11pt;">. </span></p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">아예 해결방법을찾지못해 하루정도 내내 해결방안을 찾았던것 같다.</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> </p> <p style="margin:0in;"><span style="font-family:'Malgun Gothic';font-size:11pt;">일단 </span><span style="font-weight:bold;font-family:'돋움';font-size:14pt;color:#dce0eb;background:#5c5253;">해결방법 1</span><span style="font-family:'Malgun Gothic';font-size:11pt;">은 </span></p> <p style="margin:0in;font-size:11pt;"><span style="font-family:'Malgun Gothic';">Alt+ F7을 누르거나 메뉴에서 </span><span style="font-family:'돋움';color:#e1dfdf;background:#5c5253;">(프로젝트)- > (속성)</span><span style="font-family:'Malgun Gothic';"> 으로들어가 </span></p> <p style="margin:0in;font-size:11pt;"><span style="font-family:'Malgun Gothic';">왼쪽프레임에서 </span><span style="font-family:'돋움';color:#e1dfdf;background:#5c5253;">(구성속성) -> (일반)</span><span style="font-family:'Malgun Gothic';">을 클릭하고</span></p> <p style="margin:0in;"><span style="font-family:'Malgun Gothic';font-size:11pt;">오른쪽프레임에서 아래 </span><span style="text-decoration:underline;font-family:'돋움';font-size:8.25pt;color:#e1dfdf;background:#5c5253;">문자집합</span><span style="font-family:'Malgun Gothic';font-size:11pt;"> 에 있는 </span><span style="font-family:'돋움';font-size:11pt;color:#e1dfdf;background:#5c5253;">(유니코드문자 집합 사용)을 (멀티바이트 문자 집합 사용)</span><span style="font-family:'Malgun Gothic';font-size:11pt;">으로 해준다면 왠만큼 프로그래밈이 이 전 비주얼 스튜디오 에서 코딩하는것 처럼 비슷하게 돌아간다.</span></p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">하지만, 이건 약간 룰위반이다. </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">우선 멀티바이트와유니코드를 이해해야 한다.</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">멀티바이트를 이해하기위해선 아스키 코드에 대해서도 알아야한다. </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">ASCII CODE란만약 이걸 보는 이들은 아마도 알고 있겠지만, </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">컴퓨터는 문자를인식하지 못한다. 1과 0으로 밖에 인식을 하지 못하기 때문에 인간은 그 문자를 일단 10진수 숫자와 16진수 숫자와 매치시켜 놓는다.예를들어, 숫자가 73이면 16진수로는 0x4C고 문자는 L 이 된다. </p> <p style="margin:0in;"><span style="font-family:'Malgun Gothic';font-size:11pt;"> 이모든걸 결정한 곳은 어느 말을 쓰는 나라 일까? 바로 미쿡. 따라서 모든 ASCII CODE는 영어로만 이루어져 있다. 사실</span><span style="text-decoration:underline;font-family:'돋움';font-size:8.25pt;color:#e1dfdf;background:#5c5253;">ASCII 라는 말은 American Standard Code for InformationInterchange의 약자</span><span style="font-family:'Malgun Gothic';font-size:11pt;">다.미국 표준이란 소리지. 걔네들이 한국어나 따른 나라 언어 알게 뭐가 있었겠어?</span></p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> 아무튼그렇게 10진수와 16진수로 옮겨놓으면 2진수로 만드는건 뭐 식은죽을 그냥 앉아서 천천히 TV보면서 먹는 그런 느낌이 되어버렸지.그리고 </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> 부호를포함한 1 Byte즉 8 bit의 2진수로 나타낼수 있는 수는 0000000 부터 1111111 까지. 즉 0부터 127까지다.</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">알파벳은 총 몇개?어이어이 세지 말고 ㅋㅋㅋ 26개다. A~Z까지 26개고 음... 그래 대소문자 다 합쳐봐야 52개 에다가... 음.. 그래 숫자도 넣어두면편하겠찌 그래서 숫자도 넣고. 음.. 또 뭐 없을까? 그래 따옴표하고 구두점하고 수학기호하고 뭐 그런것들좀 집어넣어서 채우다 채우다 좀 남아서비트들을 활용하여 (그래픽 문자)도 모자라 (제어문자)까지 꽉꽉 채워 넣었다 .제어문자란 음.. DEL키라던가Space라던가 ESC라던가 그런거 있잖아. 아 그런 공간 좀 남으면 한글이나 넣어줄것이지! 라고 말하고 싶지만 사실 인접 국가.미국에서 자주사용되는 스폐인어 고유 글자조차 부호없는 1byte(ASCII CODE Extended)에 겨우 포함이 될 정도다.</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> </p> <p style="margin:0in;"><span style="font-family:'Malgun Gothic';font-size:11pt;"> 자,이제 아스키코드란걸 조금은 이해를 하겠나? 음... ASCII CODE가 궁금하다면 </span><a target="_blank" href="http://ko.wikipedia.org/wiki/Ascii" target="_blank"><span style="font-family:'돋움';font-size:8.25pt;background:#5c5253;">http://ko.wikipedia.org/wiki/Ascii</span></a></p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">위키피디아를 찾아보아도좋음 :)</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">자, 이제 ASCIICODE란 걸 왠만큼 알았으니 멀티바이트로 넘어가 보자. 그럼 멀티 바이트란 무엇인가?</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">바로 이ASCII CODE는 잘 해봐야 1Byte 인데 왜 싱글 바이트가 아닌 멀티 바이트인가?</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> 즉슨, 위에서 언급했던대로 Signed 1byte안에는 only english다. 뭐, 숫자나 뭐그런거 말고 다른 나라의 언어는 없다는이야기이다. 그리고 unsigned는 그외 프랑스, 스페인, 따깔, 더치어등 잉글리시와 비슷한 언어들만 확장형으로 넣어두고 나머지는 표그리기나그림그리용으로 채워 넣었다. </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> 그럼 이제비주얼스튜디오에서 멀티바이트로 하고 hello world 코딩을 해보자. 아, 영어말고 printf("헬로 월드"); 요롷게당당하게 한국어로 해보자. 출력은 어떻게 나오는가? 한국어로 나오지 않는가?! 와우. 분명 ASCII CODE에는 영어 밖에 없다. 미국표준이므로. 하지만 어떻게 한글이 나오지? 물론 개중에는 한글이 지원하지 않아 이상한 상형문자들이 나오는 경우가 있다. 그 이유는 나중에점차점차 알아가도록 하고. 어찌되었든 한국어가 나온다. 그 이유가 멀티바이트에 있다. 이 문자를 인식할때 싱글바이트, 즉 1Byte로만 인식을하면 영어만 인식을 한다. 왜냐? 1Byte안에 영어, 한국어, 중국어, 일본어 같은 것들을 모두 넣다보면 그 옛날 꼬물 컴퓨터를 쓸때만들어진 표준으로써는 그당시 현실에 너무 안맞기 때문이다. 그렇게 몇년을 쓰다가 그걸 또 2Byte로 넘기기엔 표준이 송두리채 바뀌기가 쉽지않았다. 따라서 하나의 대안을 제시한다.</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">1Byte를 두개 해서문자를 표현하자고!!!</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">영어를 할땐1Byte만 하면 되고 만약 영어이외의 한국어나 일어, 한자를 표현할때는 1Byte 여러개를 붙여 문자를 표현하기로 한다. 그 것이ISO-2200(ISO-2200-KR, ISO-2200-JP, ISO-2200-CN) 에 정의 되어 있는 멀티바이트 문자열이다. 뭐조금 자세히 들여다 본다면 그 1byte의 21-7E를 2개 이어붙여 94*94=8836개의 글자를 표현할수 있다. 좀더 자세히들어가 유닉스쪽얘기를 한다면 유닉스에서는 그 표준이 약간다른데(EUC:Extended Unix Code로 EUC-KR, EUC-JP, EUC-CN으로표기한다.) 두개의 바이트를 이어붙이는게 A1-FE 까지라는것을 제외하면 표현할수 있는 글자수도 같아 뭐 비슷비슷하게 사용할수 있다.</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> </p> <p style="margin:0in;"><span style="font-family:'Malgun Gothic';font-size:11pt;">자,이제 멀티바이트에 대해 약간이나마 감이 좀 잡히나? 간단히 말해 </span><span style="font-weight:bold;text-decoration:underline;font-family:'돋움';font-size:8.25pt;color:#e1dfdf;background:#5c5253;">ASCII CODE 1Byte를 두개이상 붙여만들었기떄문에 멀티바이트</span><span style="font-family:'Malgun Gothic';font-size:11pt;">라고 한다.</span></p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">그렇다면 유니코드란무엇인가?</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">ASCII는 영어일경우는1Byte, 다른나라 언어는 +a를 하게된다. 그렇다면 어떤 일이 벌어지는가?</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">다른 나라 언어에+a를 한다고 해도, 만약 한국어로 된 문장을 일본어로 해석하게 되면 어떻게 되겠는가? 이런 연유로 가끔씩 페이지를 돌아다닐때 홈페이지 전체가상형문자로 덮혀있는 페이지를 발견하게 되는것이다. 즉, 글자가 깨진다고 하는것이다.</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> 자, 이것을위해 유니코드가 태어났다. 이 American놈들의 지저분한 Standard를 꺠고 Universial한 Code를 만들어 냈다.그것이 바로 유니코드다. 이 유니코드는 두개를 이어 붙이는게 아니라 처음부터 2Byte를 할당하여 파일 하나에 컴퓨터로 표현하는 세상 모든문자를 담았다. 하지만 아직은 인터넷계의 주류를 담고 있는 영어에 뭔가 불리하지 않겠는가? 쓰지도 않을 일본어때문에 굳이 용량을 키우면 뭔가좀 거시기 하지 않겠는가?라는 생각이 들어 이 유니코드도 3가지로 나눠져 있다. 그거슨 UTF-8, UTF-16, UTF-32 로나눈다.</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">UTF-8이 그ASCII CODE와 같이 8비트만을 이용한 글자. UTF-16은 16비트를 사용하고 UTF-32는 32비트를 사용하여 글자를 나타낸다.하지만 이것은 말했듯이 ASCII CODE처럼 두개의 1 Byte를 이어붙이는 것이 아니라 순수하게 1byte면 1byte,2byte면 2 byte를 사용한다. 그래서 인터넷보면 UTF-8 인터넷 주소만 이용 뭐 이런게 있는데 즉, 한글주소나뭐그런거 다 빼고 영어만 쓰겠음. 뭐 그런거다. </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">자, 이렇게 ASCIICODE와 UNICODE는 그 근본적으로 차이가 있다. 따라서 개발자는 죽어나간다. 표준이 여러개라...</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"><br></p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">그렇다면 아까의 그비주얼 스튜디오 2010에서 유니코드로 윈도우즈 프로그래밍을 할수 있는 두번째 방법을 소개 하겠다. 개념은 그리 어렵지 않다. </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> 그저멀티바이트 즉, ASCII CODE가 아닌  UNICODE를 사용하면된다. </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">하지만 방법은 막어렵지는 않지만 간단하지만은 않다. 왜냐하면, 이 C++이 만들어 질땐 ASCII CODE를 전제로 만들어져 기본적인 명령어는 대부분ASCII CODE를 기반으로 만들어 졌기때문에 그것을 요리해서 UNICODE도 사용할 수 있도록 변경해야 한다. 문자열이 들어가는 곳이라면대부분의 코드를 손을 보아야한다. 따라서 ASCII CODE, 즉 일반적인 C에 적응되어 있는 분들은 문자열이 나온다면 긴장을 해야 할것이다.</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">물론, C++에서 막문법을 떄고 오신분들이라면 우선 여기에 먼저 적응해지면 되긴 하겠지만 그래도 윈도우즈 프로그래밍에서는 char 가 직접적으로는 절대 안쓰인다고생각해야한다.</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> 자, 그럼어떤걸 쓰느냐?</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">char는 TCHAR로사용한다. TCHAR의 정의를 보면 </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">#ifdefUNICODE</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">typedefwchar_t TCHAR;</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">#else</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">typedef charTCHAR;</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">#endif</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">만약, UNICODE를사용한다면, wchar_t형의 TCHAR를 사용하고 유니코드가 아니면 그냥 char를 사용할께용. 이라는 뜻이다. 그렇다면 wchar_t는무엇인가? 음... int는 정수형을 담기위한 자료 저장 범위를 지정하기 위한 "자료형"이다. 그렇다면 UNICODE를 위한저장 크기를 제한한 자료형정도가 되겠다. 정확히 말하면 저거슨 unsigned short로 정의 되어있다.(for UTF-16)</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> 사실 일반멀티바이트라면 char를 사용하고 유니코드라면 wchar_t의 자료형을 사용하면 된다. 하지만 xp이후 유니코드가 대세가 되어가고 있고마소또한 유니코드를 권장하고 있다.</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">또 몇개의 자료형을 더찾아보자면</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">TCHAR : char</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">LPSTR : char*</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">LPCSTR :const char*</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">LPWSTR :wchar_t*</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">LPCWSTR :const wchar_t*</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">LPCTSTR :const wchar_t * || const char*</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">이렇게 있겠는데 음..헝가리언 명명법이라고는 알고 있을란지... 아무튼 이름 붙이는 방법이다. 그 이름 붙이는 방법중 약어를 쓰는경우가 있는데 STR은 딱봐도string이라는거 알겠고 다른 약어들을 대충 찾아본다면</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">W : Widechar (2바이트를 의미. 대충 유니코드따라잡기용 ASCII Code라 생각하면 됨)</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">T : unicode|| ASCII</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">C : constant</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">LP : longpointer</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">STR :string자료형</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"> </p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">그리고 이 유니코드를지원하는 문자열함수도 따로 있으니 아래의 함수들을 이용하면 된다.</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">strlenlstrlen</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">strcpylstrcpy</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">strcatlstrcat</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">strcmplstrcmp</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"></p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;">sprintfwsprintf</p> <p style="margin:0in;font-family:'Malgun Gothic';font-size:11pt;"><br></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">자, 이제 실전이다. 뭐, 다들 책이나 기본적인 윈도우즈 프레임 툴은 어떻게 짜는지 알것이다. </span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"><br></span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">내가 배운것은 </span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"><br></span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">#include <windows.h></span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">HINSTANCE g_hInst;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">LPCSTR lpszClass="First";</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow)</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">{</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> HWND hWnd;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> MSG Message;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WNDCLASS WndClass;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> g_hInst=hInstance;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WndClass.cbClsExtra = 0;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WndClass.cbWndExtra = 0;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WndClass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WndClass.hIcon = LoadIcon(NULL,IDI_APPLICATION);</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WndClass.hInstance = hInstance;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WndClass.lpfnWndProc=WndProc;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WndClass.lpszClassName=lpszClass;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WndClass.lpszMenuName=NULL;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WndClass.style = CS_HREDRAW|CS_VREDRAW;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> RegisterClass(&WndClass);</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> hWnd = CreateWindow(lpszClass,lpszClass,WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,(HMENU)NULL,hInstance,NULL);</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> ShowWindow(hWnd,nCmdShow);</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"><br></span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> while(GetMessage(&Message,NULL,0,0))</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> {</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">  TranslateMessage(&Message);</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">  DispatchMessage(&Message);</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> }</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> return (int)Message.wParam;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">}</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">LRESULT CALLBACK WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam)</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">{</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> switch(iMessage)</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> {</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> case WM_DESTROY : PostQuitMessage(0);</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">  return 0;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> }</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> return (DefWindowProc(hWnd,iMessage,wParam,lParam));</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">}</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"><br></span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">요 코드다. 자, 그렇다면 유니코드를 해놓고 비주얼 스튜디오 2010에서 돌리면 어디가 에러가 나는가?</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">바로 hWnd=CreateWindow 요 줄에 있는 두번째 배개변수 lpszClass가 문제다. 왜냐하면 윈도우즈 함수에서는 분명히 유니코드를 이용하겠다고 했는데 이 lpszClass는 아직 유니코드가 아닌갑다. 그래서 나는 이 lpszClass의 유니코드명이 뭔지 한참이나 찾았으나 인터넷에는 도저히 나와있지 않다. 왜냐하면!! lpszClass는 내가 코드안에서 생성해준 변수명이잖아-_ -;;;;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"><br></span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">자, 5번줄을 보면 </span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">LPCSTR lpszClass="First";</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">요게 있었어..</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">복습을 해보자.</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">LPCSTR은 Const하고 long pointer하고 str인것이다. 유니코드의 흔적조차 없다.</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">그러면 어떻게 해야할까?</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"><br></span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">그거야 바로 LPC와 STR사이에</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">W나 T를 넣어주면 된다. 다른 코드들과의 이식성을 위해 일부러 연습을 위해서라도 LPCTSTR을 사용해주기로 한다. </span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">자, 이제 해결?!</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"><br></span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">5번줄만 바꿔서 </span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">LPCTSTR lpszClass="First";</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">자, 디버깅 해보자.</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"><br></span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">으악! 에러다. 에러다. 에러다. ㅠㅜㅠ 아 도대체 왜!!!</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">자, 읽어보자면 </span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">error C2440: '초기화 중' : 'const char [6]'에서 'LPCTSTR'(으)로 변환할 수 없습니다.</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">라고 뜬다.</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">즉슨, 그럼 "First" 가 5자리+NULL의 문자열 상수일테고 왼쪽은 LPCTSTR이다.</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">음.. LPCTSTR은 틀릴리가 없고, 그럼 const char [6]이 틀렸다는 건데.</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">일단 내가 짠것은 유니코드니 wchar_t const * != const char[6] 라는 소리겠지.</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">틀린말은 아니다, "First"는 분명한 문자열 상수고 그것을 다른 자료형에 넣을순 없는거니까.</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">자, 그러면 형변환이다!</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"><br></span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">자, 그럼 유니코드 안에서 LPCTSTR == wchar_t const * 이니까 </span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">LPCTSTR lpszClass == (wchar_t const *)"First";</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"><br></span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">라고 고 치고 해보자.... 와우!!! 디버깅 에러 없고, 컴파일 제대로 되..... 었지만 출력물이 이상하다. 무슨 이상한 한자하고 잡스러운게 많이 나온다. ㅠㅠㅠㅠㅠㅠ 앙데 ㅠㅠ</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"><br></span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">음... 이것의 이유는 찾아본 결과 일단, 강제 형변환에 있다. 일반적인 char 형과 유니코드의 공간 할당 크기가 다르고 이것을 강제적으로 형변환을 할때 그 할당공간 크기 차이의 빈자리를 쓰레기값이 들어가 쓰레기 글자가 나오게 되는 것이다.</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"><br></span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> 그래서 자연스레 형변환을 해주는 접두어가 있었으니 그거슨 바로 L이다.</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> 라이토는 아니고, 음... 정확히 찾아보진 못했지만. L이다.</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"><br></span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> 사용방법은. 그냥 일반 접두어처럼 사용하면 된다.</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> </span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">LPCTSTR lpszClass=L"First";</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"><br></span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">요롷게 하면 디버깅도 되고 컴파일도 되고 실행도 된다. 제대로 출력도 된다.</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">하지만 이렇게 하면 사실 LPCTSTR을 쓴 의미가 없어진다. 왜냐하면 이 L은 유니코드형으로의 형변환이다. 선택적 형변환을 하기 위해선 TEXT()함수를 사용해야한다. 이 TEXT한수를 사용할 경우엔 이것도 T와 마찬가지로 알아서 유니코드면 유니코드, 일반 ANSI면 일반 char로 알아서 변환한다.</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"><br></span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">다시 말해 </span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"><br></span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">LPCTSTR lpszClass=TEXT("First");</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"><br></span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">가 최종 답안이라는거지 :) </span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">아.. 여기까지 달려오시느라 참 수고 많으셨고(다 읽었을리는 없겠지만)</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">최종 코드를 공개하겠다.(거창하진 않지만)</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"><br></span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">아래 코드로 컴파일 하여 실행한다면 유니코드든 멀티바이트든 에러없이 실행 된다:)</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"><br></span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">#include <windows.h></span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">HINSTANCE g_hInst;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">LPCTSTR lpszClass=TEXT("First");</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow)</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">{</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> HWND hWnd;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> MSG Message;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WNDCLASS WndClass;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> g_hInst=hInstance;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WndClass.cbClsExtra = 0;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WndClass.cbWndExtra = 0;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WndClass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WndClass.hIcon = LoadIcon(NULL,IDI_APPLICATION);</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WndClass.hInstance = hInstance;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WndClass.lpfnWndProc=WndProc;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WndClass.lpszClassName=lpszClass;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WndClass.lpszMenuName=NULL;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> WndClass.style = CS_HREDRAW|CS_VREDRAW;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> RegisterClass(&WndClass);</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> hWnd = CreateWindow(lpszClass,lpszClass,WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,(HMENU)NULL,hInstance,NULL);</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> ShowWindow(hWnd,nCmdShow);</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> </span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> //MessageBox(hWnd,L"하이",TEXT("Test"),NULL);</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> while(GetMessage(&Message,NULL,0,0))</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> {</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">  TranslateMessage(&Message);</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">  DispatchMessage(&Message);</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> }</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> return (int)Message.wParam;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">}</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">LRESULT CALLBACK WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam)</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">{</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> switch(iMessage)</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> {</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> case WM_DESTROY : PostQuitMessage(0);</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">  return 0;</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> }</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;"> return (DefWindowProc(hWnd,iMessage,wParam,lParam));</span></font></p> <p style="margin:0in;"><font face="Malgun Gothic"><span style="font-size:14.6666669845581px;line-height:17.6000003814697px;">}</span></font></p></div>

    이 게시물을 추천한 분들의 목록입니다.
    푸르딩딩:추천수 3이상 댓글은 배경색이 바뀝니다.
    (단,비공감수가 추천수의 1/3 초과시 해당없음)

    죄송합니다. 댓글 작성은 회원만 가능합니다.

    번호 제 목 이름 날짜 조회 추천
    57
    내 웃음벨 [1] 크고거대한거 21/07/30 20:59 852 7
    56
    그놈의 빅픽처 [7] 크고거대한거 18/04/25 11:36 1343 12
    55
    차량 후방 스티커는 아이의 우선 구조를 목적으로... [6] 크고거대한거 18/04/25 11:24 1560 15
    54
    [18] 성진국의 프로레슬링 체험관 [3] 크고거대한거 18/04/25 11:16 1870 13
    53
    [4] 크고거대한거 17/12/13 15:53 53 1
    52
    일본 4.5년차 입니다. 질문받습니다. [19] 외부펌금지 크고거대한거 17/12/06 10:43 128 2
    51
    도쿄도에서 만든 도쿄 도민 대상 지진 대응 매뉴얼 [1] 크고거대한거 17/11/15 15:01 373 13
    50
    v3에 설치에 관해서 크고거대한거 17/04/18 11:48 214 6
    49
    혹시 3.20 전산대란을 기억하시나요? [1] 크고거대한거 17/04/13 11:10 314 2
    48
    명언3 [11] 크고거대한거 17/03/23 09:33 70 5
    47
    명언2 크고거대한거 17/03/23 09:29 51 4
    46
    명언1 [3] 크고거대한거 17/03/23 09:25 62 2
    45
    헤드폰 선택장애임. 3개중에 추천좀 해주세요. [5] 본인삭제금지 크고거대한거 17/02/22 14:22 35 1
    44
    문재인 지지자들의 네거티브전략과 시사게의 민주당원게시판화에 대해 [26] [차단]핵노잼 17/01/25 11:33 414 6/21
    43
    도쿄에도 왔어요. 일본가준 진도3짜리. 니넴동화의피 16/09/13 19:19 158 2
    42
    도쿄사는 징어의 지진 팁 하나 [4] 니넴동화의피 16/09/12 23:05 474 7
    41
    체육관 전투에 대한 나노 팁 [3] 창작글 긍정주의자왕 16/07/27 10:44 105 4
    40
    도쿄입니다 일본서버 터진것 같네요 [6] 긍정주의자왕 16/07/22 17:57 208 1
    39
    메모 [2] 비공감합디다 15/09/07 23:47 24 0
    [반말주의] 비쥬얼스튜디오에서 유니코드로 에러날때.. [4] 비공감합디다 15/07/25 01:07 48 0
    37
    이제 곧 색깔론이 들어올 차례네요. [2] 비공감합디다 15/07/23 16:48 182 0
    36
    이번 오늘의 메뉴 게임은 역시 이상민이 우승할 줄 알았습니다 [40] 비공감합디다 15/07/11 20:18 222 13
    35
    [ㅂㅅㄱ] css 셀렉터 질문있습니다! [11] 본인삭제금지 비공감합디다 15/07/01 19:52 16 1
    34
    아니... 오늘이 어떤 날인데... [4] 비공감합디다 15/06/22 20:05 61 2
    33
    for(int i ;;) 에서 i의 의미 [17] 비공감합디다 15/06/04 00:16 58 2
    32
    코딩 유머 [7] 비공감합디다 15/05/27 12:08 73 10
    31
    개발자 뻘글. IDE에 대해. [13] 누군지알아? 15/05/17 21:54 48 2
    30
    오늘의 유머사이트에 숨겨진기능 [1] 누군지알아? 15/05/02 13:36 91 0
    29
    java-android 설계/코드 노하우 관련 slide 누군지알아? 15/04/18 14:15 34 0
    28
    용과같이 제로 엔딩 봤어요! 누군지알아? 15/03/26 09:31 46 0
    [1] [2]
    단축키 운영진에게 바란다(삭제요청/제안) 운영게 게시판신청 자료창고 보류 개인정보취급방침 청소년보호정책 모바일홈