ºÝºÝߣ
Submit Search
12 ?????? ??? ??
?
0 likes
?
986 views
jaypi Ko
Follow
WM_MOUSEMOVE in Button
Read less
Read more
1 of 18
Download now
Downloaded 23 times
More Related Content
12 ?????? ??? ??
1.
CHAP. 12 ?????? ???
?? 1
2.
2 ??? ????? ???? ??
??? ??? ?? ??? ???? ?? ?? ?? ??? 11??? ?? Notification ?? ??? ?? ?? ¢ô ????? ??? ?? ?? ¢ô? ??? ??? ??? ???
3.
3 ??? ???? ????
?? ???? ??? ?????? WM_COMMAND ????? ? ???? ????? ?? ?? ? ???, int wNofifyCode = HIWORD(wParam) int wID = LOWORD(wParam); HWND hWndCtrl = (HWND)lParam; WM_COMMAND ???? Notification Code? ?? ???? ?? ?? ?? WM_COMMAND?? ?? ?? WM_COMMAND? ?? ???? WM_XXXX? ??? ? ?? ?? ?? ??, WM_MOUSEMOVE ?? ?
4.
4 ?? ??? ???
??? ? ??? ?? ?? ??? ?? ???? ?? ???? ????? ??? ? ?? ???, ??? ??? ??
5.
5 ?? ?? ???,
??? ??? ? ?? ?? ??? ???? ?? ??? WM_MOUSEMOVE ??? ?? ?? int x = LOWORD(lParam) int y = HIWORD(lParam) ?? ?? HDC hdc; hdc = GetDC(hWnd); TextOut(hdc, x, y, "hello", 5); ReleaseDC(hWnd, hdc);
6.
6 LRESULT CALLBACK WndProc(HWND
hWnd, UINT mesg, WPARAM wParam, LPARAM lParam) { static HWND hBtn; switch(mesg) { case WM_CREATE: hBtn = CreateWindow("BUTTON", "button", WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON, 0, 0,100,100,hWnd,(HMENU)888,_hInstance, NULL); break; case WM_MOUSEMOVE: HDC hdc; char szPos[32]; sprintf(szPos, "%03d %03d", LOWORD(lParam),HIWORD(lParam)); hdc = GetDC(hWnd); TextOut(hdc, 102, 0, szPos, strlen(szPos)); ReleaseDC(hWnd, hdc); break; case WM_DESTROY: PostQuitMessage(0); return FALSE; } return DefWindowProc(hWnd, mesg, wParam, lParam); } ?? ???? ??? ???? ?? ????? ???? ??? ??? ??
7.
7 ???? ??, ?? ???
??? ?? ?? ??? ?? ?? ??? ??????? WM_MOUSEMOVE ?????? ?? ????. ?? ???? ? ?? ??? ?????? ??? ??
8.
8 ?? ?????? WM_MOUSEMOVE
??? ?? ?? ???? ???? ??? ???? ?? ??
9.
9 ?? ?????? WM_MOUSEMOVE
??? ?? ???? ?? ?? ? ??. ??? ?? ? ?? ?? ???? ??? ??
10.
10 ?? ?????? WM_MOUSEMOVE
??? ?? ?? ??? ??? ?? ????? ???? ??? ????? ???? WM_MOUSEMOVE ??? ?? ? ??? ???? (??) ???? ?? ???? ??. ????? ? ?? ???
11.
11 ?? ?????? WM_MOUSEMOVE
??? ?? ?? ??? ??? ?? ????? ???? ?? ?? ???? ??? ????? ????
12.
12 ??? ???? ???
??? ?? ¢Ù ??? ???? ?? ¢Ú ?? ???? ???? ?? ?? ?? ??? ??? ??? ??? LRESULT CALLBACK WndProc(HWND hWnd, UINT mesg, WPARAM wParam, LPARAM lParam) { switch(mesg) { case WM_MOUSEMOVE: break; } return DefWindowProc(hWnd, mesg, wParam, lParam); } SetWindowLong() ?? ??? ? ???
13.
13 ?? ????? ???? ??
?? ??? ?? ??? ??, ?? ?? ?? ??? ?? ?? ??? ?? ??? ?? ???? ??? ??, ???? ?? ¢Ù? ??? ? ?? ?? ?? ???? ?? return DefWindowProc(hWnd, mesg, wParam, lParam); LRESULT CALLBACK WndProc(HWND hWnd, UINT mesg, WPARAM wParam, LPARAM lParam) { switch(mesg) { case WM_MOUSEMOVE: break; } return } CallWindowProc( ¡); ?? ?? ??? ???? ?? ????? ??
14.
14 ?? ????? ?? ???? GetWindowLong() ??
??? ?? ?? ??? ?? ???? ?? ??
15.
15 ??? ???? ???
??? ?? ???? ¢Ù ??? ???? ?? ¢Ú ?? ???? ???? ?? - ?? ???? ?? ?? - ??? ????? ?? CallWindowProc() GetWindowLong() SetWindowLong() ? ??? ? ?? ?? ?? ?? ??? ??? ?? ?~?? ???? ???? ??
16.
16 #include <windows.h> LRESULT CALLBACK
WndProc(HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK BtnProc(HWND, UINT, WPARAM, LPARAM); HINSTANCE _hInstance; WNDPROC _fpOldBtnProc; LRESULT CALLBACK WndProc(HWND hWnd, UINT mesg, WPARAM wParam, LPARAM lParam) { static HWND hBtn; switch(mesg) { case WM_CREATE: hBtn = CreateWindow(¡); _fpOldBtnProc = (WNDPROC)GetWindowLong(hBtn, GWL_WNDPROC); SetWindowLong(hBtn1, GWL_WNDPROC, (LONG)BtnProc); break; ¡ } ?? ?? ???? ?? ?? ??? ??? ???? ????? Get Window Long ??? ???? ?? ???? ???? ??? ??? WNDPROC ??? ??? ????? ??? ?????????
17.
17 LRESULT CALLBACK BtnProc(HWND
hWnd, UINT mesg, WPARAM wParam,LPARAM lParam) { switch(mesg) { case WM_MOUSEMOVE: HDC hdc; HWND hParent; hParent = GetParent(hWnd); char szPos[32]; sprintf(szPos, "%03d %03d", LOWORD(lParam),HIWORD(lParam)); hdc = GetDC(hParent); TextOut(hdc, 102, 32, szPos, strlen(szPos)); ReleaseDC(hParent, hdc); break; } return CallWindowProc(_fpOldBtnProc,hWnd,mesg,wParam,lParam); } ?? ??? ?? ?? ???? ?? ???? ??? ??? ????? ???
18.
18 LONG GetWindowLong(HWND hWnd,
int nIndex); LRESULT CallWindowProc(WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); LONG SetWindowLong(HWND hWnd, int nIndex, LONG dwNewLong); ?? ?? ????? GWL_EXSTYLE ?? ??? ??? GWL_STYLE ??? ??? GWL_WNDPROC ??? ???? ?? GWL_HINSTANCE ???? ?? GWL_HWNDPARENT ?? ??? ?? GWL_ID ??? ??? CreateWindowEx()? ??? ??? nIndex
Download