본문 바로가기

프로그래밍/C, C++20

MFC - Visual Studio 6.0 with Platform SDK 2003 설정 Platform SDK 다운로드 링크주소는 아래와 같습니다. Windows® Server 2003 SP1 Platform SDK Full Download (Full 다운로드 버전) Windows® Server 2003 SP1 Platform SDK Web Install (Web 설치 버전) 1. Platform SDK 설치 후 헤더(Include files)와 라이브러리(Library files)폴더 설정을 아래와 같이 해 주세요. Visual Studio 6.0의 메뉴에서 Tool -> Options -> Directories 으로 가서 아래와 같이 설정 해 주세요. (※ Platform SDK 헤더와 라이브러리가 먼저 선택되도록 리스트에서 상단으로 옮겨주세요.) 2. Platform SDK 2003 .. 2019. 2. 19.
MFC - CString GetBuffer(), ReleaseBuffer() 사용 아래와 같이 char배열 포인터를 받아서 전화번호 문자열을 복사해주는 함수가 있다고 가정했을 때, void GetPhoneNumber(char *buf) { strcpy(buf, "010-1234-5678"); } 받은 전화번호 데이터를 다시 CString으로 처리해야하는 경우, 보통 아래와 같이 처리를 합니다. CString str; char sz[20] = { 0, }; GetPhoneNumber(sz); str = sz; // str 사용... 이를 CString의 GetBuffer(), GetRelease()함수를 사용하여 아래와 같이 간단하게 처리할 수 있습니다. CString str; GetPhoneNumber(str.GetBuffer(20)); str.ReleaseBuffer(); // st.. 2019. 1. 25.
C, C++ 문자열 인코딩(iconv) iconv 라이브러리를 활용하여 문자열 인코딩 하는 방법입니다. iconv 라이브러리 홈페이지는 "https://www.gnu.org"입니다. (다운로드: https://www.gnu.org/software/libiconv/#downloading) 최신 리눅스의 경우는 기본 설치가 되어 있으며, 설치가 안 되어 있는 경우는 apt-get, rpm 혹은 소스 설치하시면 됩니다. OS가 윈도우인 경우는 라이브러리 파일(*.tar.gz)안에 README.windows에 명시되어 있는대로 빌드하여 사용하시면 됩니다. 주요 함수 설명 iconv_t iconv_open(const char* tocode, const char* fromcode); 설명: 현재 문자셋, 변경할 문자셋을 지정하고 Conversion De.. 2016. 12. 23.
C, C++ 파일 존재 유무 확인 bool IsFileExist(char *szFileFullPath) { FILE *file = fopen(szFileFullPath, "r"); if (file) { fclose(file); return true; } return false; } 2016. 11. 21.
MFC - 폼뷰(FormView)를 다이얼로그(Dialog)처럼 테두리 없애기 "PreCreateWindow, OnInitialUpdate" 함수를 아래와 같이 재정의 해 줍니다. BOOL CMediaManagerView::PreCreateWindow(CREATESTRUCT &cs) { // TODO: CREATESTRUCT cs를 수정하여 여기에서 // Window 클래스 또는 스타일을 수정합니다. cs.style &= ~(WS_BORDER); //추가 cs.style &= ~(WS_THICKFRAME); //추가 cs.style &= ~(WS_DLGFRAME); //추가 return CFormView::PreCreateWindow(cs); } void CMediaManagerView::OnInitialUpdate() { GetParent()->ModifyStyleEx(WS_EX.. 2016. 10. 18.
MFC - 예외(Exception) 처리 (try catch, CException) Exception 에러 메세지창으로 띄우기 try { // Exception 발생 구문 } catch (CException *ex) { ex->ReportError(); } Excption 에러 메세지 얻어오기 try { // Exception 발생 구문 } catch (CException *ex) { TCHAR szMsg[1024] = {0,}; ex->GetErrorMessage(szMsg, 1024); CString strMsg; strMsg.Format(/*적절한 메세지 만들기*/); ::AfxMessageBox(strMsg); } 위에 예문을 토대로 함수를 만들어 봤습니다. Made by 꾸션 헤더 CString GetErrorDescription(CException *ex); CString G.. 2015. 2. 9.
반응형