프로그래밍/Windows API
-
How To Use UpdateLayeredWindow프로그래밍/Windows API 2012. 3. 5. 09:52
In this post I will briefly explain how to use layered windows and specifically how to use UpdateLayeredWindow. The first thing you need to do is add the WS_EX_LAYERED style to your window. This can for example be done with a call to CreateWindowEx: hWnd = CreateWindowEx(WS_EX_LAYERED, szWindowClass, szTitle, 0, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);After your window i..
-
Urldownloadtofile()프로그래밍/Windows API 2009. 5. 6. 12:17
URLDownloadToFile http 를 이용해 파일을 다운받기 위한 함수. 예전에 잠깐 테스트를 위해서 써본적이 있고, 단순히 파일을 받는것에는 아무 문제가 없었다. 하지만 당시 일반적인 http request 가 아니었기 때문에 http socket class 를 코딩했었다. URLDownloadToFile 자체 보다는 콜백 인터페이스를 상속받아서 구현한 부분이 오히려 가치가 있는 소스다. source 부를때 CBindTransferStatus m_bindTransfer; ... ... HRESULT hr = URLDownloadToFile(NULL, "http://a.b.c/d.avi", "c:\\d.avi", dwReserved, &m_bindTransfer); 콜백 인터페이스 구현 CBind..
-
파일 관련 API프로그래밍/Windows API 2005. 6. 24. 05:36
파일을 다루는데 사용되는 API함수엔 다음과 같은 함수가 있습니다. CreateFile, WriteFile, ReadFile 우선 파일을 열거나 생성할때는 CreateFile 함수가 사용됩니다. 함수원형HANDLE CreateFile( LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTE lpSecurityAttributes, DWORD dwCreationDispostion, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile ); lpFileName : 생성 또는 오픈할 파일의 경로와 파일이름( NULL로 끝나는 문자열 ) dwDesiredAccess : 파일 접근 모드. ..
-
파일 대화상자프로그래밍/Windows API 2005. 6. 24. 05:36
메모장 같은 프로그램을 실행해서 파일을 저장할때나 불러올때 보면 파일을 선택할 수 있는 다이얼로그 창이 있습니다. 이 다이얼로그 창은 겉보기엔 파일을 조작하는 기능을 할것 같지만 실제론 단순히 파일 이름만을 읽어들이는 기능을 합니다. 가령 예를들어 메모장에서 바탕화면에 있는 'aaa.txt'라는 파일을 파일 대화상자로 불러들였다면 파일대화상자는 단지 aaa.txt의 파일 위치, 즉 경로만을 리턴해주는 역할을 합니다. 물론 파일을 다루는건 CreateFile이나 ReadFile같은 함수죠. 함수 원형BOOL GetOpenFileName( LPOPENFILENAME lpofn ); 매개변수lpofn : OPENFILENAME 구조체변수의 포인터 이 함수는 OPENFILENAME이라는 구조체만 인수로 받고 있..
-
TransparentBlt 함수 관련프로그래밍/Windows API 2005. 6. 24. 05:35
TransparentBlt 함수는 BOOL TransparentBlt( HDChdcDest, // handle to destination DC intnXOriginDest, // x-coord of destination upper-left corner intnYOriginDest, // y-coord of destination upper-left corner intnWidthDest, // width of destination rectangle inthHeightDest, // height of destination rectangle HDChdcSrc, // handle to source DC intnXOriginSrc, // x-coord of source upper-left corner intnYOr..
-
hdc, MemDC 관련해서...프로그래밍/Windows API 2005. 6. 24. 05:34
MemDC(메모리DC)는 일반 hdc 보다 더 강력한 기능을 가지고 있다.. hBitmap 이 있을때 1. SelectObject(MemDC, hBitmap) - 이렇게 하면 메모리 DC가 비트맵 사이즈만큼 확장되면서 비트맵의 그림이 메모리DC에 그려진다. 2. SelectObject(hdc, hBitmap)- hBitmap를 SelectObejct은 메모리 DC만 가능하다. 옆과 같이 했을경우 아무일도 안일어난다. 그리고 동시에 두개의 메모리DC가 하나의 hBitmap을 SelectObject를 할수는 없다. Msdn내용 - Bitmaps can be selected for memory DCs only, and for only one DC at a time.
-
CreateCompatibleDC, CreateCompatibleBitmap 함수 차이점.프로그래밍/Windows API 2005. 6. 24. 05:34
CreateCompatibleDC(HDC hdc) - hdc에 NULL 써줘도 된다. NULL 써주면 내부적으러 스크린 DC 얻어서 사용한다. GetDC(NULL)와 비슷한원리 CreateCompatibleBitmap(HDC hdc, int Widht, int Height) - hdc에 NULL 써주면 안된다!! ex) g_MemDC = CreateCompatibleDC(NULL); // ok g_hBitmap = CreateCompatibleBitmap(hdc, 1024, 768); // 에러 리턴 HDC hdc = GetDC(g_hWnd); g_hBitmap = CreateCompatibleBitmap(hdc, 1024, 768); // ok g_hOldBitmap = (HBITMAP)SelectOb..