{"id":319,"date":"2014-08-09T09:10:37","date_gmt":"2014-08-09T18:10:37","guid":{"rendered":"http:\/\/blog.box.kr\/?p=319"},"modified":"2014-08-09T09:10:37","modified_gmt":"2014-08-09T18:10:37","slug":"mfc-ftp-%ec%a0%91%ec%86%8d-%eb%b0%8f-%ed%8c%8c%ec%9d%bc-%eb%8b%a4%ec%9a%b4","status":"publish","type":"post","link":"https:\/\/blog.box.kr\/?p=319","title":{"rendered":"[MFC] &#8211; FTP \uc811\uc18d \ubc0f \ud30c\uc77c \ub2e4\uc6b4"},"content":{"rendered":"<p style=\"color: #000000;\">\n<p style=\"color: #000000;\">void CTestFTP::FTP_DOWN(CString filename)<br \/>\n{<\/p>\n<p style=\"color: #000000;\">\u00a0CInternetSession session;<\/p>\n<p style=\"color: #000000;\">\u00a0CFtpConnection *pConnection = NULL;<\/p>\n<p style=\"color: #000000;\">\ntry {<\/p>\n<p style=\"color: #000000;\">\/\/\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0IP\uc8fc\uc18c\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ID\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Password<\/p>\n<p style=\"color: #000000;\">\u00a0\u00a0pConnection = session.GetFtpConnection(\u00a0 _T(&#8220;111.222.33.4&#8221;), _T(&#8220;abcd&#8221;), _T(&#8220;<a style=\"color: #3bafda;\" href=\"mailto:en4u@dbsmedia\">12345<\/a>&#8220;));<\/p>\n<p style=\"color: #000000;\">\n<p style=\"color: #000000;\">\u00a0\u00a0\/\/ \uc5f0\uacb0\uc774 \uc548\ub410\uc744 \uacbd\uc6b0<br \/>\nif (!pConnection) {<br \/>\nAfxMessageBox(_T(&#8220;Error&#8221;));<br \/>\n<span id=\"callbacknestwabartistorycom861513\"><\/span>\u00a0\u00a0\u00a0pConnection = NULL;<br \/>\nreturn;<br \/>\n}<\/p>\n<p style=\"color: #000000;\">\npConnection-&gt;SetCurrentDirectory(_T(&#8220;\/s&#8221;));<\/p>\n<p style=\"color: #000000;\">\u00a0\u00a0CString str;<\/p>\n<p style=\"color: #000000;\">\u00a0\u00a0pConnection-&gt;GetCurrentDirectory(str);\/\/ FTP \uc11c\ubc84\uc758 \ud3f4\ub354 \uacbd\ub85c \uc5bb\uae30\n<\/p>\n<p style=\"color: #000000;\">\u00a0\u00a0CString RemoteStr;<br \/>\nCString LocalStr;<br \/>\nRemoteStr.Format( _T(&#8220;%s\/%s&#8221;),m_ProgramPath,filename\/*_T(&#8220;abcd.exe&#8221;)*\/); \/\/ ftp\ub0b4 \ud3f4\ub354 \uc704\uce58 \ubc0f \ud30c\uc77c\uba85<br \/>\nLocalStr.Format(_T(&#8220;%s\\%s&#8221;), path, filename);\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/\u00a0\ubcf5\uc0ac\ub420\u00a0 \uc704\uce58 \ubc0f \ud30c\uc77c\uba85<\/p>\n<p style=\"color: #000000;\">\u00a0\u00a0pConnection-&gt;GetFile(RemoteStr, LocalStr, FALSE,FILE_ATTRIBUTE_NORMAL,FTP_TRANSFER_TYPE_ASCII |\u00a0INTERNET_FLAG_RELOAD,NULL);<\/p>\n<p style=\"color: #000000;\">\/\/windows 7 64bit\u00a0\uc5d0\uc11c \u00a0\uc815\uc0c1\ub3d9\uc791 \ud558\uc9c0 \uc54a\uc744 \uacbd\uc6b0\u00a0&#8216;INTERNET_FLAG_RELOAD&#8217;\u00a0\u00a0\ud50c\ub798\uadf8 \ucd94\uac00<\/p>\n<p style=\"color: #000000;\">\n<p style=\"color: #000000;\">\u00a0} catch (CInternetException *pEx) {<\/p>\n<p style=\"color: #000000;\">\u00a0\u00a0pEx-&gt;ReportError(MB_ICONEXCLAMATION);<\/p>\n<p style=\"color: #000000;\">\u00a0\u00a0pConnection = NULL;<\/p>\n<p style=\"color: #000000;\">\u00a0\u00a0pEx-&gt;Delete();<\/p>\n<p style=\"color: #000000;\">\u00a0}<\/p>\n<p style=\"color: #000000;\">\u00a0pConnection-&gt;Close();<\/p>\n<p style=\"color: #000000;\">}<\/p>\n<p style=\"color: #000000;\">\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>void CTestFTP::FTP_DOWN(CString filename) { \u00a0CInternetSession session; \u00a0CFtpConnection *pConnection = NULL; try { \/\/\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0IP\uc8fc\uc18c\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ID\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Password \u00a0\u00a0pConnection = session.GetFtpConnection(\u00a0 _T(&#8220;111.222.33.4&#8221;), _T(&#8220;abcd&#8221;), _T(&#8220;12345&#8220;)); \u00a0\u00a0\/\/ \uc5f0\uacb0\uc774 \uc548\ub410\uc744 \uacbd\uc6b0 if (!pConnection) { AfxMessageBox(_T(&#8220;Error&#8221;)); \u00a0\u00a0\u00a0pConnection = NULL; return; } pConnection-&gt;SetCurrentDirectory(_T(&#8220;\/s&#8221;)); \u00a0\u00a0CString str; \u00a0\u00a0pConnection-&gt;GetCurrentDirectory(str);\/\/ FTP \uc11c\ubc84\uc758 \ud3f4\ub354 \uacbd\ub85c \uc5bb\uae30 \u00a0\u00a0CString RemoteStr; CString LocalStr; RemoteStr.Format( _T(&#8220;%s\/%s&#8221;),m_ProgramPath,filename\/*_T(&#8220;abcd.exe&#8221;)*\/); \/\/ ftp\ub0b4 \ud3f4\ub354 \uc704\uce58 \ubc0f \ud30c\uc77c\uba85 LocalStr.Format(_T(&#8220;%s\\%s&#8221;), path, filename);\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/\u00a0\ubcf5\uc0ac\ub420\u00a0 \uc704\uce58 \ubc0f \ud30c\uc77c\uba85 \u00a0\u00a0pConnection-&gt;GetFile(RemoteStr, LocalStr, FALSE,FILE_ATTRIBUTE_NORMAL,FTP_TRANSFER_TYPE_ASCII |\u00a0INTERNET_FLAG_RELOAD,NULL); \/\/windows 7 64bit\u00a0\uc5d0\uc11c \u00a0\uc815\uc0c1\ub3d9\uc791 \ud558\uc9c0 \uc54a\uc744 \uacbd\uc6b0\u00a0&#8216;INTERNET_FLAG_RELOAD&#8217;\u00a0\u00a0\ud50c\ub798\uadf8 \ucd94\uac00 \u00a0} catch (CInternetException *pEx) { \u00a0\u00a0pEx-&gt;ReportError(MB_ICONEXCLAMATION); \u00a0\u00a0pConnection = NULL; \u00a0\u00a0pEx-&gt;Delete(); \u00a0} \u00a0pConnection-&gt;Close(); } &nbsp;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"ngg_post_thumbnail":0,"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[9,19,7],"tags":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5q9Zn-59","jetpack-related-posts":[{"id":441,"url":"https:\/\/blog.box.kr\/?p=441","url_meta":{"origin":319,"position":0},"title":"CStirng \u2194 char * (Unicode \u2194 ANSI)","date":"2014-12-15","format":false,"excerpt":"\u203b\u00a0Format \uc9c0\uc815 \uac00\ub2a5 (CString \u2192 char *) \/\/\u00a0Static CString strText = _T(\"casting test\"); char szText[128]; sprintf_s(szText, 128, \"%S\", strText); \/\/ Using\u00a0szText... \/\/ Dynamic CString strText = _T(\"casting test\"); const size_t size = strText.GetLength(); char *pszText = new char[size]; sprintf_s(pszText,\u00a0size, \"%S\", strText); \/\/ Using\u00a0pszText... \/\/ \ub625 \uce58\uc6b0\ub294 \uac70 \uc78a\uc9c0\ub9d0\uc790 delete\u00a0pszText; \u203b\u2026","rel":"","context":"In &quot;C\/C++&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":250,"url":"https:\/\/blog.box.kr\/?p=250","url_meta":{"origin":319,"position":1},"title":"[\uac1c\ubc1c\/VC++] URLEncode, URLDecode, \uc720\ub2c8\ucf54\ub4dc \ubcc0\ud658 \uc18c\uc2a4","date":"2014-07-23","format":false,"excerpt":"[\uac1c\ubc1c\/VC++] URLEncode, URLDecode, \uc720\ub2c8\ucf54\ub4dc \ubcc0\ud658 \uc18c\uc2a4 IT\/\uac1c\ubc1c\u00a02011\/02\/10 12:08 [\uac1c\ubc1c\/VC++] URLEncode, URLDecode, UTF8 \ubcc0\ud658 \uc18c\uc2a4 [\uc720\ub2c8\ucf54\ub4dc \ubb38\uc790\uc9d1\ud569\uc6a9] CString Unicode_URLDecode( CString strEncodedText ) { CString strResult; wchar_t ch0, ch1, ch2; wchar_t wch; TCHAR tch; int i = 0; while( i<strEncodedText.GetLength() ) { tch = strEncodedText.GetAt(i); if( tch != _T('%') ) { \/\/\u2026","rel":"","context":"In &quot;C\/C++&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":325,"url":"https:\/\/blog.box.kr\/?p=325","url_meta":{"origin":319,"position":2},"title":"[MFC] &#8211; \ub3d9\uc77c \uc5b4\ud50c \ubc18\ubcf5 \uc2e4\ud589 \ubc29\uc9c0","date":"2014-08-09","format":false,"excerpt":"SDI \ub85c \uc791\uc5c5\ud558\uc600\ub2e4\uba74,\u00a0\uc751\uc6a9\ud504\ub85c\uadf8\ub7a8 \uac1d\uccb4\uc5d0 \ud574\ub2f9 \ud568\uc218\ub97c \uc120\uc5b8 \ud6c4 \ucd94\uac00. \uadf8\ub9ac\uace0 \ud504\ub85c\uadf8\ub7a8\uc774\ub984(IDS_APP_NAME)\uc744 \ub9ac\uc18c\uc2a4\uc5d0 \ub4f1\ub85d\ud558\uac70\ub098, \uac00\uc838\uc640\uc11c \uc0ac\uc6a9 BOOL CWebBroApp::IsRunning(void) { CString appName = _T(\"\"); appName.LoadString(IDS_APP_NAME); \/\/\u00a0HANDLE hMuxtex = CreateMutex(NULL, TRUE, (LPCTSTR)TEXT(\"ADIcon\")); HANDLE hMuxtex = CreateMutex(NULL, TRUE, (LPCTSTR)appName); if(GetLastError() == ERROR_ALREADY_EXISTS) \u00a0{ ReleaseMutex(hMuxtex); CWnd *pWndPre = NULL, *pWndChild = NULL; \/* if(pWndPre =\u2026","rel":"","context":"In &quot;C\/C++&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":305,"url":"https:\/\/blog.box.kr\/?p=305","url_meta":{"origin":319,"position":3},"title":"[MFC] \ub0b4\ubd80 \ucc3d\ub07c\ub9ac \uba54\uc2dc\uc9c0 \uc1a1\uc218\uc2e0","date":"2014-08-07","format":false,"excerpt":"\ud074\ub798\uc2a4\uac04 \ub370\uc774\ud130 \uc804\ub2ec\uc744 \ud558\ub294 \ubc29\ubc95\uc774 \ubb34\uc5c7\uc774 \uc788\uc744\uae4c. 1. \uc804\uc5ed\ubcc0\uc218 2. \ud5e4\ub354 include \ud6c4 \ubcc0\uc218 \uc811\uadfc 3. SendMessage SendMessage\ub97c \uc774\uc6a9\ud558\uba74 \ud074\ub798\uc2a4\uac04 \ub370\uc774\ud130 \uc804\ub2ec\uc774 \uc6a9\uc774\ud568\uc744 \uc54c\uace0, \uc0ac\uc6a9\ud574\ubcf4\uc558\ub2e4(\uba87\ubc88\uc758 \uc0bd\uc9c8\uacfc \ud568\uaed8...) ? 1 2 3 4 5 6 7 8 9 10 11 12 LRESULT SendMessage( \u00a0\u00a0\u00a0\u00a0UINT message, \u00a0\u00a0\u00a0\u00a0WPARAM wParam = 0, \u00a0\u00a0\u00a0\u00a0LPARAM lParam\u2026","rel":"","context":"In &quot;C\/C++&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":166,"url":"https:\/\/blog.box.kr\/?p=166","url_meta":{"origin":319,"position":4},"title":"\uba54\uc2dc\uc9c0 \ud6c5(Message Hook)","date":"2014-07-08","format":false,"excerpt":"\uba54\uc2dc\uc9c0 \ud6c5(Message Hook) \u00a0 \ud504\ub85c\uadf8\ub7a8\uc5d0\uc11c \ubc1c\uc0dd\ud558\ub294 \uba54\uc2dc\uc9c0\ub97c \uac10\uc2dc\ud558\uba74\uc11c \ud2b9\uc815 \uba54\uc2dc\uc9c0\uac00 \ucc98\ub9ac\ub418\uae30 \uc804\uc5d0 \ud574\ub2f9 \uba54\uc2dc\uc9c0\ub97c \uac00\ub85c\ucc44\uc5b4 \ubcc4\ub3c4\ub85c \uc815\uc758\ub41c \uae30\ub2a5\uc744 \uc218\ud589\ud558\ub3c4\ub85d \uc9c0\uc6d0\ud558\ub294 \ud504\ub85c\uadf8\ub798\ubc0d \uae30\ubc95\uc744 \uc758\ubbf8\ud569\ub2c8\ub2e4. \uc774\ub7ec\ud55c \ub9e4\ucee4\ub2c8\uc998\uc744 \uc774\uc6a9\ud558\uc5ec \ub2e4\ub978 \ud504\ub85c\uadf8\ub7a8\uc758 \ucc98\ub9ac\uac00 \uc77c\uc5b4\ub098\uae30 \uc804\uc5d0 \uc6d0\ud558\ub294 \uae30\ub2a5\uc744 \uc218\ud589\ud558\ub3c4\ub85d \uad6c\ud604\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. 1. \ud6c5\uc758 \uc885\ub958 1) \uc804\uc5ed \ud6c5 \uc708\ub3c4\uc6b0 \uc804\uccb4 \uc601\uc5ed\uc5d0 \ubc1c\uc0dd\ud558\ub294 \uba54\uc2dc\uc9c0\ub97c \uac10\uc2dc \ubcc4\ub3c4\uc758\u2026","rel":"","context":"In &quot;MFC &amp; WINDOWS&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":182,"url":"https:\/\/blog.box.kr\/?p=182","url_meta":{"origin":319,"position":5},"title":"[Grid] BCG Grid Ctl \uc774\ubca4\ud2b8 \ubaa8\uc74c","date":"2014-07-09","format":false,"excerpt":"\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ const DWORD dwViewStyle =\u00a0WS_CHILD | WS_VISIBLE; CRect rcTmp; CBCGPGridRow* pRow; CString strTmp; m_staticFileAntPatternHoriListLoc.GetClientRect(&rcTmp); m_staticFileAntPatternHoriListLoc.MapWindowPoints(this, &rcTmp); m_listFileAntPatternHoriList = NULL; m_listFileAntPatternHoriList = new CCellTypesGridCtrl(); if (!m_listFileAntPatternHoriList->Create (dwViewStyle, rcTmp, this, IDC_LIST_FILE_ANT_PATTERN_HORI_LIST)) { TRACE0(\"Failed to create workspace viewn\"); return ;\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ fail to create } m_listFileAntPatternHoriList->SetWholeRowSel (FALSE); m_listFileAntPatternHoriList->EnableMarkSortedColumn (FALSE); m_listFileAntPatternHoriList->EnableHeader (TRUE, BCGP_GRID_HEADER_SELECT); m_listFileAntPatternHoriList->EnableRowHeader\u2026","rel":"","context":"In &quot;C\/C++&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/blog.box.kr\/index.php?rest_route=\/wp\/v2\/posts\/319"}],"collection":[{"href":"https:\/\/blog.box.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.box.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.box.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.box.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=319"}],"version-history":[{"count":0,"href":"https:\/\/blog.box.kr\/index.php?rest_route=\/wp\/v2\/posts\/319\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.box.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.box.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.box.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}