SetCapture() , ReleaseCapture()는 win32 api , MFC CWnd 멤버함수 모두 제공됨.
기능 : 마우스가 활성 윈도우 영역을 벗어난 경우에도 마우스 이벤트 받을 수 있게 하는것.
HWND SetCapture( HWND hWnd );
Sets the mouse capture to the specified window belonging to the current thread.SetCapture captures mouse input either when the mouse is over the capturing window, or when the mouse button was pressed while the mouse was over the capturing window and the button is still down. Only one window at a time can capture the mouse.
If the mouse cursor is over a window created by another thread, the system will direct mouse input to the specified window only if a mouse button is down.
ReleaseCapture()
SetCapture()했던것을 다시 해제 하는것. 본인 코드에서 SetCapture() 사용 다했다면 ReleaseCapture() 해줘야 함.
header file : winuser.h
docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setcapture
CWnd::SetCapture()
Return Value
A pointer to the window object that previously received all mouse input. It is NULL if there is no such window. The returned pointer may be temporary and should not be stored for later use.
Remarks
When CWnd no longer requires all mouse input, the application should call the ReleaseCapture function so that other windows can receive mouse input.
While mouse input is captured, no WM_NCHITTEST or WM_SETCURSOR messages are sent to the active window.
연관
드래그 드롭 구현 시 필수 활용됨.
첫 등록 : 2020.09.25
최종 수정 :
단축 주소 : https://igotit.tistory.com/2625
'VisualStudio.C++.C# > 코딩팁,함수활용,단편' 카테고리의 다른 글
MFC. CWnd::PreTranslateMessage . WM_KEYDOWN 핸들러로 수신못할 때. (0) | 2020.09.30 |
---|---|
MFC. 드래그 드롭 시 텍스트 안보이는 문제 해결 . 폰트 설정 (0) | 2020.09.26 |
CWnd::OnNotify, OnCommand (0) | 2020.09.24 |
MFC. 컨트롤 동적 생성시 이벤트 핸들링 (0) | 2020.09.24 |
MFC. CListCtrl. 리스트 컨트롤. (0) | 2020.09.24 |
댓글