{"id":234,"date":"2014-06-17T13:49:15","date_gmt":"2014-06-17T04:49:15","guid":{"rendered":"http:\/\/csharp.ihavenomoney.co.kr\/?p=234"},"modified":"2014-06-17T13:49:15","modified_gmt":"2014-06-17T04:49:15","slug":"onsavedocumentlpctstr-lpszpathname-source","status":"publish","type":"post","link":"https:\/\/csharp.ihavenomoney.co.kr\/?p=234","title":{"rendered":"OnSaveDocument(LPCTSTR lpszPathName) source"},"content":{"rendered":"<p><a href=\"http:\/\/csharp.ihavenomoney.co.kr\/wp-content\/uploads\/2014\/06\/CFileSave.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/csharp.ihavenomoney.co.kr\/wp-content\/uploads\/2014\/06\/CFileSave-300x184.png\" alt=\"CFileSave\" width=\"300\" height=\"184\" class=\"alignnone size-medium wp-image-235\" srcset=\"https:\/\/csharp.ihavenomoney.co.kr\/wp-content\/uploads\/2014\/06\/CFileSave-300x184.png 300w, https:\/\/csharp.ihavenomoney.co.kr\/wp-content\/uploads\/2014\/06\/CFileSave.png 823w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<pre id=\"code_snippet_63\" 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 = _T(&quot;\\&quot;Demo Page \\&quot;\\r\\n&quot;);\r\n\t\ttemp += _T(&quot;\\&quot;If you want show this page, you must save file\\&quot;\\r\\n&quot;);\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            \/\/bSuccess = ::SaveDIB(m_hDIB, file);\r\n\t\t\tfile.Write(temp,length*2);\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>\n","protected":false},"excerpt":{"rendered":"","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-234","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\/234","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=234"}],"version-history":[{"count":1,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/234\/revisions"}],"predecessor-version":[{"id":236,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/234\/revisions\/236"}],"wp:attachment":[{"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}