TCHAR -> string 변환, C++ 문자열 자료형 컨버팅 TCHAR에서 std::string으로 변환하는 예제 코드입니다. 12345678910111213const std::string TCHARToString(const TCHAR* ptsz){ int len = wcslen((wchar_t*)ptsz); char* psz = new char[2 * len + 1]; wcstombs(psz, (wchar_t*)ptsz, 2 * len + 1); std::string s = psz; delete[] psz; return s;}Colored by Color Scriptercs 위 함수 코드에 인자에 TCHAR 배열을 넘기면 string 변수가 리턴됩니다. 예를 들면 아래처럼 사용할 수 있습니다. 12..
CFileDialog, 윈도우7과 윈도우XP 호환 소스 (Modal Dialog) 아래는 CFileDialog를 이용한 Modal 소스인데 문제 될 것이 없는 평범한 소스입니다. CFileDialog를 Modal로 여는 것이죠. 1234567891011CFileDialog oFileDlg(TRUE, "bmp", "*.bmp", OFN_FILEMUSTEXIST | OFN_LONGNAMES, "BMP Files", this); oFileDlg.m_ofn.lpstrInitialDir = "C:\\"; oFileDlg.DoModal(); if(oFileDlg.GetPathName().Compare("") != 0){...........................}Colored by Color Scripterc..
[MFC강좌] CreateFont(), CFont 사용 방법 (static 폰트 변경 방법 예제) 이번 MFC강좌에선 CFont의 CreateFont() 사용 방법을 알아보겠습니다. CreateFont를 사용하기 위해선 하나의 객체를 생성한 뒤, 폰트(CFont)를 설정하기 위한 각종 인자들을 넘겨줘야 됩니다. 함수 원형은 아래입니다. 123456789101112131415CFont fntItem; fntItem.CreateFont( 15, // 문자 폭 0, // 문자 높이 0, // 문자 기울기 0, // 문자 방향 FW_NORMAL, // 문자 굵기 FALSE, // 기울기 FALSE, // 밑줄 0, // 취소선 DEFAULT_CHARSET, // 문자셋 OUT_DEFAULT_PRECIS, // ..