본문 바로가기

(MFC) CMainFrame 크기 변경하는 방법 MFC에서 CMainFrame의 크기를 조절하려면 PreCreateWindow() 부분을 수정해주면 된다. 다음과 같이 처리하면 된다! 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE; cs.cx = 300; // 이 부분을 설정해주면 된다!(x 크기) cs.cy = 200; // 이 부분을 설정해주면 된다!(y 크기) cs.dwExStyle &= ~WS_EX_CLIENTEDGE; cs.lpszClas.. 더보기
(C++) 간단한 boost::shared_ptr 사용 예제 boost::shared_ptr은 적당한 시점에 알아서(?) delete가 되는 어마어마한 객체입니다!(원래는 boost 라이브러리이지만 C++11에도 포함이 되서 std::shared_ptr로도 사용할 수 있습니다!) 기초 개념을 이해할 수 있도록 아주 간단한 예제를 소개합니다! 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 #include #include class Person { public: char* getName() { return name; } void setName(char* _name) { name = _name; } private: char* name; }; int main(int argc, char **argv) { boost::.. 더보기
(C++) ifstream을 사용할 때 라인 단위로 출력하기(getline 이용) ifstream을 사용할 때 라인 단위로 파일 내용을 출력하고 싶다면 다음과 같이 하면 됩니다.(이해하기 쉬운 직관적인 코드입니다!) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #include #include #include int main(int argc, char **argv) { std::ifstream oFile("c:\\HaxLogs.txt"); for(std::string line; std::getline(oFile, line);) { std::cout 더보기