c2 [프로그래밍][c/c++] Copy CString to clipboard. CString 클립보드에 붙여넣기 매번 사용자에게 IP를 입력하도록 요구 받는데, default로 자주 쓰이는 IP는 정해져 있다.미리 클립보드에 붙여넣기를 해두면 입력할때 paste만 하면되니 편할 것 같아서 구글링하여아래와 같이 함수를 만들었다. void copyToClipboard(const CString strText){HGLOBAL h; LPTSTR arr; size_t bytes = (strText.GetLength()+1)*sizeof(TCHAR); h=GlobalAlloc(GMEM_MOVEABLE, bytes); arr=(LPTSTR)GlobalLock(h); ZeroMemory(arr,bytes); _tcscpy_s(arr, strText.GetLength()+1, strText); //strText.ReleaseBuff.. 2016. 9. 13. 폴더 안의 모든 파일 목록 가져오기 get list of files in a directory http://stackoverflow.com/questions/612097/how-can-i-get-the-list-of-files-in-a-directory-using-c-or-c folder에 경로만 넣어주면 됨. 굳굳#include vector get_all_files_names_within_folder(string folder) { vector names; char search_path[200]; sprintf(search_path, "%s*.*", folder.c_str()); WIN32_FIND_DATA fd; HANDLE hFind = ::FindFirstFile(search_path, &fd); if(hFind != INVALID_HANDLE_VALUE) { do { // read all .. 2015. 7. 15. 이전 1 다음 반응형