본문 바로가기

SoftWare_API_MFC16

MFC 에서 CString 문자열을 특정 문자를 기준으로 자르고 싶을 때 프로그래밍을 하다 보면 "," 또는 "/" 같은 단어로 연결되어진 문자열을 잘라라 할 때가 있다. C에서야 strtok를 사용한다고 치지만(사실 strtok 함수에도 문제점이 존재한다.) MFC에서 CString 문자열을 사용하는 경우에는? 바로, AfxExtractSubString() 이라는 함수가 있다. 사용법은 굉장히 간단하다. 예를 들면... CString example = "a,b,c,d,e,f"; CString subText = ""; AfxExtractSubString(subText, example , 0, ','); // subText에 "a"가 들어감 AfxExtractSubString(subText, example , 1, ','); // subText에 "b"가 들어감 AfxExtra.. 2022. 3. 8.
How to make a virtual tree control — really virtual How to Make CTreeCtrl Virtual Here is the problem: You have a bunch of data which naturally come in a tree structure — but the entire tree is large, cumbersome, and/or expensive to generate, and naturally, only one or a few leaf elements of the tree will eventually be needed. There are virtual list controls where one list can have millions of entries and is still fast, because the elements are o.. 2022. 2. 17.
Visual Studio 2017에서 stdio.h 사용하는 방법 [파일] - [새로만들기] - [프로젝트] 좌측 [ Visual C++] 하위항목 [Windows 데스크톱] - 중앙 화면에서 [Windows 데스크톱 마법사] - [확인] 팝업 좌측 [빈 프로젝트] 체크, [SDL 검사] 체크해제 - [확인] 우측 솔루션 탐색기 [ 소스파일] 우클릭 - [추가] - [새 항목] 팝업 중앙 [C++파일(.cpp)] 선택하고 하단파일 이름에서 .cpp에서 pp지우고 .c만 남김 - [확인] #include int main() { printf("Hello \n"); return 0; } 2021. 4. 12.
[C++ / MFC] 더블 버퍼링 (double buffering) 화면DC에 바로 그림을 그릴 경우 화면이 깜빡이는 현상이 발생하는데 그 현상을 해결하기 위해 메모리DC를 만들고 그 메모리DC에 그림을 그린 후 화면DC로 한번에 복사하는 것을 더블 버퍼링 이라고 한다. 더블 버퍼링을 사용하지 않는 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 void CDCDraw::NotDoubleBuffering(void) { CWnd* pWnd = NULL; pWnd = GetDlgItem(IDC_ST_PICTURE); CDC *pDCc = pWnd->GetDC(); CRect rect; pWnd->GetClientRect(&rect); CPen *pOldPen = NULL; CBrush *pOldBru.. 2021. 2. 26.