본문 바로가기
728x90
반응형

프로그래밍56

python Convert list to ascii 12345ans = ""m = s.model()for i in xrange(0, num): ans += unichr(long(str(m[l[i]])))print anscs 자꾸 헷갈리니까 저장. 2016. 7. 5.
파일 속성 변경 - SetFileAttributes 함수 이름 그대로 파일의 속성을 세팅하는 함수. 1234BOOL WINAPI SetFileAttributes( _In_ LPCTSTR lpFileName, _In_ DWORD dwFileAttributes);cs 악성코드 분석하다가 알게 되었다. 전에 분석하던 악성코드는 악성코드가 하는 일들을 수행하고 자기 자신을 숨김 파일로 변경하였음. 속성에 대한 define 값은 MSDN을 참고. https://msdn.microsoft.com/ko-kr/library/windows/desktop/aa365535(v=vs.85).aspx 123456789101112#include#include#includeint main() { char buf[MAX_PATH]; GetModuleFileNameA(NULL, buf.. 2016. 1. 11.
버튼 클릭하면 이미지 나오게 하기 1234567891011121314151617LRESULT OnCommand(HWND hWnd, WPARAM wParam, LPARAM lParam){ switch (LOWORD(wParam)){ case 100: hdc = GetDC(hWnd); MemDC = CreateCompatibleDC(hdc); OldBitmap = (HBITMAP)SelectObject(MemDC, hBitmap[0]); BitBlt(hdc, 30, 30, 500, 500, MemDC, 0, 0, SRCCOPY); SelectObject(MemDC, OldBitmap); DeleteDC(MemDC); ReleaseDC(hWnd, hdc); break; case 101: break; } return 0;}Colored by C.. 2015. 7. 26.
연산자 오버라이딩, sort, 생성자 12345678910111213141516171819202122232425#include#includestruct block{ int n, a, h, w; block(){} block(int n, int a, int h, int w) :n(n), a(a), h(h), w(w) {} bool operator 2015. 6. 7.
아스키코드 -> 유니코드 문자열 변환 함수 1234567891011#include#include#include#includeint main(){ TCHAR str[50] = { 0, }; USES_CONVERSION; _tcscpy(str, A2T("test")); MessageBox(NULL, str, L"test", MB_OK);}Colored by Color Scriptercs A2T를 사용하는 함수마다 한 번씩 USES_CONVERSION; 을 써줘야 하나보다. 2015. 6. 3.
WinAPI 콤보박스 생성 / ComboBox 1 2 3 4 5 6 7 8 9 10 TCHAR *str[] = { L"AOA", L"Girl's Day", L"Apink" }; int i; hSelect = CreateWindow(L"combobox", NULL, WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST, 310, 90, 155, 80, hWnd, (HMENU)CB_SELECT, g_hInst, NULL); for (i = 0; i 2015. 6. 1.
process list 출력 방법 1. NtQuerySystemInformation (windows 2000/NT 이상에서 가능)(출처: http://www.rohitab.com/discuss/topic/40504-using-ntquerysysteminformation-to-get-process-list/) 방법 2. CreateToolhelp32Snapshot 아.. 슈방 옛날에 구현해놨었는데 당시 무슨 패기였는지 삭제해버려서 다시 정리. 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657#include #include #include #pragma comment(lib,"ntdll.lib") .. 2015. 5. 20.
how to create ListView on Visual C++ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 #include HWND hList; void MakeProcListView(HWND hWnd){ LVCOLUMN COL; LVITEM Li; hList = CreateWindow(WC_LISTVIEW, NULL, WS_CHILD | WS_VISIBLE | WS_BORDER | LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL, 0, 0, 250, 200, hWnd, (HMENU)hProcList, g_hIns.. 2015. 5. 20.
알고리즘 실행 시간 계산 1234567891011#include#includeint main(){ int t = clock(); //프로그램 printf("%lf\n", (clock() - t) / CLK_TCK); return 0;}Colored by Color Scriptercs #define CLK_TCK CLOCKS_PER_SECclock()은 초 당 18.2만큼 증가한다 함..(출처 : soen.kr) 참고.typedef long clock_t 32비트 시스템에서 long = int 2015. 3. 15.
c++ 연산자 오버로딩 Colored By Color Scripter™12345678910111213141516171819202122#includeusing namespace std;class test{public: int a, b; test(int a, int b) :a(a), b(b) {} void show(){ cout 2014. 10. 29.
C++ mysql 연동 http://dev.mysql.com/downloads/connector/cpp/http://dev.mysql.com/downloads/connector/c/(위 링크는 mysql 커넥터 다운로드) #pragma comment(lib,"libmysql.lib") 프로젝트 속성 -> 구속 속성 -> VC++ 디렉터리 포함 디렉터리에 include 폴더 포함시키고 라이브러리 디렉터리에 lib 폴더 포함함. 한글 안 되면 아래 세 줄 복붙.mysql_query(connection,"set session character_set_connection=euckr;");mysql_query(connection,"set session character_set_results=euckr;"); mysql_query(con.. 2014. 9. 23.
최대공약수 구하기 - 유클리드 호제법 Colored By Color Scripter™12345#include int gcd(int p, int q){ if (q == 0) return p; return gcd(q, p%q); } 2014. 7. 8.
728x90
반응형