{"id":238,"date":"2014-06-17T17:27:49","date_gmt":"2014-06-17T08:27:49","guid":{"rendered":"http:\/\/csharp.ihavenomoney.co.kr\/?p=238"},"modified":"2014-06-17T21:37:51","modified_gmt":"2014-06-17T12:37:51","slug":"%ea%b8%80%ec%9e%90-%ec%9e%85%eb%a0%a5-%eb%b0%8f-%ec%a0%80%ec%9e%a5%ed%95%9c%ea%b8%80-%eb%af%b8%ec%a7%80%ec%9b%90","status":"publish","type":"post","link":"https:\/\/csharp.ihavenomoney.co.kr\/?p=238","title":{"rendered":"\uae00\uc790 \uc785\ub825 \ubc0f \uc800\uc7a5(\ud55c\uae00 \uc9c0\uc6d0)"},"content":{"rendered":"<p><a href=\"http:\/\/csharp.ihavenomoney.co.kr\/wp-content\/uploads\/2014\/06\/Char.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/csharp.ihavenomoney.co.kr\/wp-content\/uploads\/2014\/06\/Char-300x197.png\" alt=\"Char\" width=\"300\" height=\"197\" class=\"alignnone size-medium wp-image-239\" srcset=\"https:\/\/csharp.ihavenomoney.co.kr\/wp-content\/uploads\/2014\/06\/Char-300x197.png 300w, https:\/\/csharp.ihavenomoney.co.kr\/wp-content\/uploads\/2014\/06\/Char.png 641w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nSingleDoc.h<br \/>\n<pre id=\"code_snippet_66\" style=\"position:relative;width:100%;border:0;padding:0;\">\/\/ CSingleDoc \uba85\ub839\r\nBOOL CSingleDoc::OnSaveDocument(LPCTSTR lpszPathName)\r\n{\r\n    \/\/ TODO: \uc5ec\uae30\uc5d0 \ud2b9\uc218\ud654\ub41c \ucf54\ub4dc\ub97c \ucd94\uac00 \ubc0f\/\ub610\ub294 \uae30\ubcf8 \ud074\ub798\uc2a4\ub97c \ud638\ucd9c\ud569\ub2c8\ub2e4.\r\n\t\tCFile file;\r\n        CFileException fe;\r\n\t\tCString temp;\r\n\r\n\t\ttemp = CSingleDoc::m_Munja;\r\n\r\n\t\tint length = temp.GetLength();\r\n\r\n        if (!file.Open(lpszPathName, CFile::modeCreate |\r\n            CFile::modeReadWrite | CFile::shareExclusive, &amp;fe))\r\n        {\r\n            ReportSaveLoadException(lpszPathName, &amp;fe,\r\n                TRUE, AFX_IDP_INVALID_FILENAME);\r\n            return FALSE;\r\n        }\r\n\r\n        \/\/ replace calls to Serialize with SaveDIB function\r\n        BOOL bSuccess = FALSE;\r\n        TRY\r\n        {\r\n            BeginWaitCursor();\r\n            TCHAR *strMemo = new TCHAR[temp.GetLength()+1];\r\n    \t\t_tcscpy(strMemo,temp);\t\/\/CString\uc744 w_char* \ud615\uc73c\ub85c \uce74\ud53c\ud558\uace0\r\n\t\t\tint nLen = _tcslen(strMemo);\t\/\/\uae38\uc774\uad6c\ud558\uae30\r\n\t\t\tTCHAR szTmp[2]; \/\/w_char \uc758 2\uac1c\uc9dc\ub9ac \uc0dd\uc131(\ud55c\uae00\uc774\uc5b4\u3139\uc11c)\r\n\t\t\tWORD wd = 0xFEFF; \/\/0xfeef\ub97c \ud30c\uc77c\uc758 \uccab\ubd80\ubd84\uc5d0 \uae30\ub85d\ud574\uc11c \ud574\ub2f9 \ud30c\uc77c\uc774\r\n\t\t\t\t\t\t\t\/\/\uc720\ub2c8\ucf54\ub4dc\ud615\uc2dd\uc784\uc744 \uc54c\ub824\uc918\ud569\ub2c8\ub2e4.\r\n\t\t\t\t\t\t\t\/\/Little-Endiann \uc2dc\uc2a4\ud15c\uc740 0xfffe  \uc785\ub2c8\ub2e4.\r\n\t\t\tmemcpy(szTmp,&amp;wd,2);\t\/\/\ub9e8 \uc55e\uc5d0 \ubcf5\uc0ac\ud558\uace0\r\n\t\t\tfile.Write(szTmp,2);\t\/\/\uc720\ub2c8\ucf54\ub4dc\uc784\uc744 \uc54c\ub824\uc900\ub2e4.\r\n\t\t\tfile.Write(strMemo, nLen * sizeof(WCHAR));\t\/\/\uadf8\ub9ac\uace0 \ud30c\uc77c\uc5d0 \uc4f4\ub2e4.\r\n\t\t\tbSuccess = TRUE;\r\n            file.Close();\r\n        }\r\n        CATCH (CException, eSave)\r\n        {\r\n            file.Abort(); \/\/ will not throw an exception\r\n            EndWaitCursor();\r\n            ReportSaveLoadException(lpszPathName, eSave,\r\n                TRUE, AFX_IDP_FAILED_TO_SAVE_DOC);\r\n            return FALSE;\r\n        }\r\n        END_CATCH\r\n\r\n            EndWaitCursor();\r\n        SetModifiedFlag(FALSE);     \/\/ back to unmodified\r\n\r\n        if (!bSuccess)\r\n        {\r\n            \/\/ may be other-style DIB (load supported but not save)\r\n            \/\/  or other problem in SaveDIB\r\n            CString strMsg;\r\n            \/\/strMsg.LoadString(IDS_CANNOT_SAVE_DIB);\r\n\t\t\t\r\n\t\t\tstrMsg = _T(&quot;\uc800\uc7a5\uc911 \uc5d0\ub7ec\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4.&quot;);\r\n            MessageBox(NULL, strMsg, NULL, MB_ICONINFORMATION | MB_OK);\r\n        }\r\n\r\n        return bSuccess;\r\n\t\/\/return CDocument::OnSaveDocument(lpszPathName);\r\n}<\/pre><br \/>\nSingleView.cpp<br \/>\n<pre id=\"code_snippet_65\" style=\"position:relative;width:100%;border:0;padding:0;\">void CSingleView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)\r\n{\r\n    \/\/ TODO: \uc5ec\uae30\uc5d0 \uba54\uc2dc\uc9c0 \ucc98\ub9ac\uae30 \ucf54\ub4dc\ub97c \ucd94\uac00 \ubc0f\/\ub610\ub294 \uae30\ubcf8\uac12\uc744 \ud638\ucd9c\ud569\ub2c8\ub2e4.\r\n\tCSingleDoc* pDoc=GetDocument();\r\n\tpDoc-&gt;m_Munja += TCHAR(nChar);\r\n    pDoc-&gt;SetModifiedFlag(TRUE);\/\/\uc800\uc7a5 \ud50c\ub798\uadf8 \uc138\ud2b8 \uc124\uc815\r\n\tInvalidate();\r\n\r\n     CView::OnChar(nChar, nRepCnt, nFlags);\r\n}<\/pre><br \/>\nSingleDoc.cpp<br \/>\n<pre id=\"code_snippet_64\" style=\"position:relative;width:100%;border:0;padding:0;\">class CSingleDoc : public CDocument\r\n{\r\nprotected: \/\/ serialization\uc5d0\uc11c\ub9cc \ub9cc\ub4e4\uc5b4\uc9d1\ub2c8\ub2e4.\r\n    CSingleDoc();\r\n\tDECLARE_DYNCREATE(CSingleDoc)\r\n\r\n\/\/ \ud2b9\uc131\uc785\ub2c8\ub2e4.\r\npublic:\r\n\r\n\/\/ \uc791\uc5c5\uc785\ub2c8\ub2e4.\r\npublic:\r\n\tCString m_Munja;\r\n\r\n\/\/ \uc7ac\uc815\uc758\uc785\ub2c8\ub2e4.\r\npublic:\r\n\tvirtual BOOL OnNewDocument();\r\n\tvirtual void Serialize(CArchive&amp; ar);\r\n#ifdef SHARED_HANDLERS\r\n\tvirtual void InitializeSearchContent();\r\n\tvirtual void OnDrawThumbnail(CDC&amp; dc, LPRECT lprcBounds);\r\n#endif \/\/ SHARED_HANDLERS\r\n\r\n\/\/ \uad6c\ud604\uc785\ub2c8\ub2e4.\r\npublic:\r\n\tvirtual ~CSingleDoc();\r\n#ifdef _DEBUG\r\n\tvirtual void AssertValid() const;\r\n\tvirtual void Dump(CDumpContext&amp; dc) const;\r\n#endif\r\n\r\nprotected:\r\n\r\n\/\/ \uc0dd\uc131\ub41c \uba54\uc2dc\uc9c0 \ub9f5 \ud568\uc218\r\nprotected:\r\n\tDECLARE_MESSAGE_MAP()\r\n\r\n#ifdef SHARED_HANDLERS\r\n\t\/\/ \uac80\uc0c9 \ucc98\ub9ac\uae30\uc5d0 \ub300\ud55c \uac80\uc0c9 \ucf58\ud150\uce20\ub97c \uc124\uc815\ud558\ub294 \ub3c4\uc6b0\ubbf8 \ud568\uc218\r\n\tvoid SetSearchContent(const CString&amp; value);\r\n#endif \/\/ SHARED_HANDLERS\r\npublic:\r\n\tvirtual BOOL OnSaveDocument(LPCTSTR lpszPathName);\r\n};<\/pre>\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SingleDoc.h SingleView.cpp SingleDoc.cpp<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[],"class_list":["post-238","post","type-post","status-publish","format-standard","hentry","category-c"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/238","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=238"}],"version-history":[{"count":5,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/238\/revisions"}],"predecessor-version":[{"id":245,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/238\/revisions\/245"}],"wp:attachment":[{"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=238"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=238"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=238"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}