大一新生假期實習。。
case WM_LBUTTONDOWN:
{
pt.x=LOWORD(lParam);
pt.y=HIWORD(lParam);
}
可是LOWORD下面一直有波浪線啊。。。說未定義識別符號lParam。。。求救。。看了幾個小時還是弄不出來
uj5u.com熱心網友回復:
這個是未定義,說明你的函式的引數不是這個變數,要根據你的函式傳相應的變數uj5u.com熱心網友回復:
百度搜“WM_LBUTTONDOWN”uj5u.com熱心網友回復:
你的函式引數名不對啊。肯定是...WndProc(...LPARAM lParam)...啊
uj5u.com熱心網友回復:
case WM_LBUTTONDOWN:應該在
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
中
uj5u.com熱心網友回復:
先GetCursorPos,得到在螢屏中的坐標,然后再用ScreenToClient轉換一下就好uj5u.com熱心網友回復:
大一就有實習機會,不錯uj5u.com熱心網友回復:
pt.x=LOWORD(lParam);pt.y=HIWORD(lParam); 你這2個xy是什么型別的就強制轉換成什么型別的啊
pt.x=double(wParam);
pt.y=double(lParam);
uj5u.com熱心網友回復:
WM_LBUTTONDOWN fwKeys = wParam;xPos = LOWORD(lParam);
yPos = HIWORD(lParam);
你檢查了一下你的視窗程序函式是怎么寫的?
uj5u.com熱心網友回復:
pt.x = LOWORD(lParam);pt.y = HIWORD(lParam);
uj5u.com熱心網友回復:
case WM_RBUTTONDOWN:
case WM_LBUTTONDOWN:
// When we get a mouse down message, we know that the mouse
// is over the control. We then do the following steps
// to set up the new state:
// 1. Hit-test the coordinates of the click to
// determine in which half the click occurred.
// 2. Set the appropriate SPINNERSTATE_*CLICK state
// and repaint that clicked half. This is another
// example of a change-state-and-repaint strategy.
// 3. Send an initial scroll message.
// 4. Set the mouse capture.
// 5. Set the initial delay timer before repeating
// the scroll message.
// if (uRightBt) break;
uRightBt = message;
// Get the mouse coordinates.
x = (int) LOWORD(lParam);
y = (int) HIWORD(lParam);
// Only need to hit-test the upper half Then change-state-and-repaint
GetClientRect (hArrow, &rect);
cy = rect.bottom >> 1; // /2
//
if (y > cy)
{
StateSet(dwSpinnerState, SPINNERSTATE_DOWNCLICK);
rect.top = cy;
wScroll = SB_LINEDOWN;
}
else
{
StateSet(dwSpinnerState, SPINNERSTATE_UPCLICK);
rect.bottom = cy + 1;
wScroll = SB_LINEUP;
}
//
SetWindowLong (hArrow, GWL_SPINNERSTATE, (LONG) dwSpinnerState);
InvalidateRect (hArrow, &rect, TRUE);
UpdateWindow (hArrow);
SetCapture (hArrow);
// Process SHIFT key state along with button message
if (wParam & MK_SHIFT)
{
if (message != WM_RBUTTONDOWN)
wScroll += (WORD) (SB_TOP - SB_LINEUP);
else
wScroll += (WORD) (SB_THUMBPOSITION - SB_LINEUP);
}
else
{
if (message == WM_RBUTTONDOWN)
wScroll += SB_PAGEUP - SB_LINEUP;
bArrowTimed = SetTimer (hArrow, SB_tmID,//GetWindowLong (hArrow, GWL_ID),
200, (TIMERPROC) ArrowTimerProc);
}
// send WM_VSCROLL to parent ?
//nScrollCode = (int) LOWORD(wParam); // scroll bar value
//nPos = (short int) HIWORD(wParam); // scroll box position
//hwndScrollBar = (HWND) lParam; // handle to scroll bar
SendMessage (hArrow, WM_VSCROLL, MAKELONG(wScroll,GetWindowLong (hArrow, GWL_ID)),
(LONG) hArrow);
break;
uj5u.com熱心網友回復:
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/33429.html
標籤:界面
