本文整理汇总了C++中GET_WHEEL_DELTA_WPARAM函数的典型用法代码示例。如果您正苦于以下问题:C++ GET_WHEEL_DELTA_WPARAM函数的具体用法?C++ GET_WHEEL_DELTA_WPARAM怎么用?C++ GET_WHEEL_DELTA_WPARAM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GET_WHEEL_DELTA_WPARAM函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WndProc
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_SYSKEYDOWN:
{
if (wParam == VK_MENU)//ignore left alt stop
{
}
else
return DefWindowProc(hwnd, msg, wParam, lParam); // this makes ALT+F4 work
break;
}
case WM_CLOSE:
{
ShowWindow(hwnd, false);
PostQuitMessage(0);
break;
}
case WM_COMMAND:
break;
case WM_MOUSEWHEEL:
{
win32mouse->SetMouseWheel(GET_WHEEL_DELTA_WPARAM(wParam));
break;
}
case WM_INPUT:
{
UINT dwSize = 48; // 48 for 64bit build
static BYTE lpb[48];
GetRawInputData((HRAWINPUT)lParam, RID_INPUT,
lpb, &dwSize, sizeof(RAWINPUTHEADER)); // this gets relative coords
RAWINPUT* raw = (RAWINPUT*)lpb;
if (raw->header.dwType == RIM_TYPEMOUSE)
{
int xPosRelative = raw->data.mouse.lLastX;
int yPosRelative = raw->data.mouse.lLastY;
win32mouse->SetCursorDeltaRaw(xPosRelative, yPosRelative);
}
break;
}
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
示例2: MsgProc
//-----------------------------------------------------------------------------
// Name: MsgProc()
// Desc: The window's message handler
//-----------------------------------------------------------------------------
LRESULT WINAPI MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
switch( msg )
{
case WM_DESTROY:
PostQuitMessage( 0 );
break;
case WM_SETCURSOR:
CGameInput::getSingletonPtr()->SetCursorIcon();
break;
case WM_CHAR:
printf( "WM_CHAR\n" );
CGameInput::getSingletonPtr()->InJectChar( wParam );
break;
case WM_KEYDOWN:
printf( "WM_KEYDOWN\n" );
CGameInput::getSingletonPtr()->KeyDown( wParam, lParam );
break;
case WM_KEYUP:
printf( "WM_KEYUP\n" );
CGameInput::getSingletonPtr()->KeyUp( wParam, lParam );
break;
case WM_LBUTTONDOWN:
case WM_LBUTTONDBLCLK:
CGameInput::getSingletonPtr()->SetMouseLBtn(0);
break;
case WM_LBUTTONUP:
CGameInput::getSingletonPtr()->SetMouseLBtn(1);
break;
case WM_RBUTTONDOWN:
CGameInput::getSingletonPtr()->SetMouseRBtn(0);
break;
case WM_RBUTTONUP:
CGameInput::getSingletonPtr()->SetMouseRBtn(1);
break;
case WM_MOUSEMOVE:
CGameInput::getSingletonPtr()->MouseMove( (int)LOWORD( lParam ), (int)HIWORD( lParam ) );
break;
case WM_MOUSEWHEEL:
CGameInput::getSingletonPtr()->SetMouseWheel( GET_WHEEL_DELTA_WPARAM( wParam ) );
break;
case WM_MOVE:
g_iWinX = (int)(short) LOWORD(lParam); // horizontal position
g_iWinY = (int)(short) HIWORD(lParam); // vertical position
break;
}
return DefWindowProc( hWnd, msg, wParam, lParam );
}
示例3: GET_WHEEL_DELTA_WPARAM
LRESULT HubMessageControl::onMouseWheel(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) {
m_wheelAccumulator += GET_WHEEL_DELTA_WPARAM(wParam);
while (abs(m_wheelAccumulator) >= WHEEL_DELTA) {
const bool isNeg = m_wheelAccumulator < 0;
m_wheelAccumulator = abs(m_wheelAccumulator) - WHEEL_DELTA;
if (isNeg) {
if (m_wheelAccumulator != 0) m_wheelAccumulator = -m_wheelAccumulator;
SendMessage(WM_VSCROLL, SB_LINEDOWN);
}
else {
SendMessage(WM_VSCROLL, SB_LINEUP);
}
}
return 0;
}
示例4: switch
LRESULT CDangleWindowHex::DangleProc(UINT Msg,WPARAM wParam,LPARAM lParam)
{
//выбор по сообщению
switch(Msg)
{
case WM_KEYDOWN:
return OnKey(wParam),0;
case WM_COMMAND:
return OnCommand(LOWORD(wParam),HIWORD(wParam),(HWND)lParam),0;
case WM_MOUSEWHEEL:
return OnMouseWheel(GET_WHEEL_DELTA_WPARAM(wParam)/WHEEL_DELTA,GET_KEYSTATE_WPARAM(wParam)),0;
default:
return DefWindowProc(mhWindow,Msg,wParam,lParam);
}
}
示例5: UPDOWN_MouseWheel
/***********************************************************************
* UPDOWN_MouseWheel
*
* Handle mouse wheel scrolling
*/
static LRESULT UPDOWN_MouseWheel(UPDOWN_INFO *infoPtr, WPARAM wParam)
{
int iWheelDelta = GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA;
if (wParam & (MK_SHIFT | MK_CONTROL))
return 0;
if (iWheelDelta != 0)
{
UPDOWN_GetBuddyInt(infoPtr);
UPDOWN_DoAction(infoPtr, abs(iWheelDelta), iWheelDelta > 0 ? FLAG_INCR : FLAG_DECR);
}
return 1;
}
示例6: GET_WHEEL_DELTA_WPARAM
void CGameMain::OnMouseWheel(const WPARAM& wParam, const LPARAM& lParam){
int delta = GET_WHEEL_DELTA_WPARAM(wParam);
eMouseKeyStateMask keyState = (eMouseKeyStateMask)GET_KEYSTATE_WPARAM(wParam);
///// 鼠标所在的屏幕坐标
int x = GET_X_LPARAM(lParam);
int y = GET_Y_LPARAM(lParam); //WHEEL_DELTA
static POINT pos;
pos.x = x;
pos.y = y;
::ScreenToClient(g_hWnd, &pos); ////--> 转化为客户区坐标
//printf("OnMouseWheel %d %d (%d,%d) (%d,%d) \n", delta, keyState, x, y, pos.x, pos.y);
_gui.OnMouseWheel(x, y, delta, keyState);
}
示例7: switch
bool ExScrollBar::isPressed(unsigned int Sender, WPARAM wParam)
{
if (cState == INVISIBLE) return false;
switch (Sender) {
case WM_KEYDOWN:
{
switch (wParam)
{
case VK_UP: {if (*sValue > sMin) { *sValue = *sValue - 1; Update(); } return true; }
case VK_DOWN: {if (*sValue<sMax) { *sValue = *sValue + 1; Update(); } return true; }
case VK_PRIOR:{if (*sValue >= sMin + 5) { *sValue = *sValue - 5; Update(); } else if (*sValue>sMin) { *sValue = sMin; Update(); } return true; } /*PGUP*/
case VK_NEXT: {if (*sValue <= sMax - 5) { *sValue = *sValue + 5; Update(); } else if (*sValue<sMax) { *sValue = sMax; Update(); } return true; } /*PGDN*/
case VK_HOME: {if (*sValue>sMin) { *sValue = sMin; Update(); } return true; }
case VK_END: {if (*sValue<sMax) { *sValue = sMax; Update(); } return true; }
}
}
case WM_MOUSEWHEEL:
{
if (GET_WHEEL_DELTA_WPARAM(wParam)>0) { if (*sValue > sMin) { *sValue = *sValue - 1; Update(); } return true; }
else if (GET_WHEEL_DELTA_WPARAM(wParam) < 0) { if (*sValue < sMax) { *sValue = *sValue + 1; Update(); } return true; }
}
}
return false;
}
示例8: TwEventWin
LRESULT CALLBACK Window::WindowProc(HWND Handle, unsigned int msg, WPARAM wParam, LPARAM lParam)
{
TwEventWin(Handle,msg,wParam,lParam);
switch (msg)
{
case WM_SYSCOMMAND:
{
if (wParam == SC_CLOSE)
{
PostMessage(Handle,WM_DESTROY,0,0);
}
break;
}
case WM_DESTROY:
{
PostQuitMessage(0);
break;
}
case WM_MOUSEWHEEL:
{
if(lcMouse::Get())
lcMouse::Get()->m_uiScrollVal = GET_WHEEL_DELTA_WPARAM(wParam);
break;
}
case WM_DROPFILES:
{
HDROP hDrop = (HDROP)wParam;
int iFileCount = DragQueryFile(hDrop,0xFFFFFFFF, nullptr, MAX_PATH);
for(int i = 0;i < iFileCount;++i)
{
char a_szFileDir[256];
DragQueryFile(hDrop,i,a_szFileDir,MAX_PATH);
m_pSingleton->OnDropFile(a_szFileDir);
}
DragFinish(hDrop);
break;
}
default:
return DefWindowProc(Handle,msg,wParam,lParam);
};
return 0;
}
示例9: switch
void customize_Scene::WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam)
{
switch (iMessage)
{
case WM_MOUSEWHEEL:
Z -= (GET_WHEEL_DELTA_WPARAM(wParam) / 100);
if (Z < 0.5)
Z = 0.5f;
if (Z > 10)
Z = 10;
break;
}
}
示例10: GET_WHEEL_DELTA_WPARAM
void CDataScope::OnMouseWheel(WPARAM wParam, LPARAM lParam)
{
INT nValue = GET_WHEEL_DELTA_WPARAM(wParam);
// Update scroll info
if (nValue > 0)
{
m_fXScale *= 0.9;
}
else
{
m_fXScale /= 0.9;
}
InvalidateRect(m_hWnd, NULL, TRUE);
}
示例11: CursorEvent
void WinInputManager::Run(UINT const & msg, WPARAM wParam, LPARAM lParam)
{
if (m_listenerList.empty())
return;
eKeyCodes KeyIndex;
wchar_t buffer[1];
BYTE lpKeyState[256];
CursorEvent();
switch (msg)
{
case WM_KEYDOWN:
KeyIndex = static_cast<eKeyCodes>(wParam);
GetKeyboardState(lpKeyState);
ToUnicode(wParam, HIWORD(lParam) & 0xFF, lpKeyState, buffer, 1, 0);
KeyEvent(KeyIndex, buffer[0], true);
break;
case WM_KEYUP:
KeyIndex = static_cast<eKeyCodes>(wParam);
GetKeyboardState(lpKeyState);
ToUnicode(wParam, HIWORD(lParam) & 0xFF, lpKeyState, buffer, 1, 0);
KeyEvent(KeyIndex, buffer[0], false);
break;
case WM_LBUTTONDOWN:
MouseEvent(MOUSE_LEFT, true);
break;
case WM_LBUTTONUP:
MouseEvent(MOUSE_LEFT, false);
break;
case WM_RBUTTONDOWN:
MouseEvent(MOUSE_RIGHT, true);
break;
case WM_RBUTTONUP:
MouseEvent(MOUSE_RIGHT, false);
break;
case WM_MBUTTONDOWN:
MouseEvent(MOUSE_MIDDLE, true);
break;
case WM_MBUTTONUP:
MouseEvent(MOUSE_MIDDLE, false);
break;
case WM_MOUSEWHEEL:
MouseWheelEvent((short)GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA);
break;
}
}
示例12: switch
VOID CInputManager::MessageProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
//滚轮消息
case WM_MOUSEWHEEL:
{
if(GET_WHEEL_DELTA_WPARAM(wParam)>0)
{
m_dwMouseFlag |= MOUSE_WHEELUP;
}
else
{
m_dwMouseFlag |= MOUSE_WHEELDOWN;
}
}
break;
//键盘按下
case WM_KEYDOWN:
{
//用来处理重复的键盘按下
m_Buf_WM_KEYDOWN = std::make_pair(wParam, lParam);
m_bCatchKeyDown = true;
// AxTrace(0, 2, "Push:%d", wParam);
}
break;
//鼠标
case WM_LBUTTONDBLCLK:
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
case WM_MOUSEMOVE:
{
m_ptMouseNow.x = GET_X_LPARAM(lParam);
m_ptMouseNow.y = GET_Y_LPARAM(lParam);
}
break;
//文字输入
case WM_CHAR:
case WM_IME_COMPOSITION:
CGameProcedure::s_pUISystem_->InjectInput_CHAR(hWnd, message, wParam, lParam);
break;
}
}
示例13: ImGui_ImplDX10_WndProcHandler
IMGUI_API LRESULT ImGui_ImplDX10_WndProcHandler(HWND, UINT msg, WPARAM wParam, LPARAM lParam)
{
ImGuiIO& io = ImGui::GetIO();
switch (msg)
{
case WM_LBUTTONDOWN:
io.MouseDown[0] = true;
return true;
case WM_LBUTTONUP:
io.MouseDown[0] = false;
return true;
case WM_RBUTTONDOWN:
io.MouseDown[1] = true;
return true;
case WM_RBUTTONUP:
io.MouseDown[1] = false;
return true;
case WM_MBUTTONDOWN:
io.MouseDown[2] = true;
return true;
case WM_MBUTTONUP:
io.MouseDown[2] = false;
return true;
case WM_MOUSEWHEEL:
io.MouseWheel += GET_WHEEL_DELTA_WPARAM(wParam) > 0 ? +1.0f : -1.0f;
return true;
case WM_MOUSEMOVE:
io.MousePos.x = (signed short)(lParam);
io.MousePos.y = (signed short)(lParam >> 16);
return true;
case WM_KEYDOWN:
if (wParam < 256)
io.KeysDown[wParam] = 1;
return true;
case WM_KEYUP:
if (wParam < 256)
io.KeysDown[wParam] = 0;
return true;
case WM_CHAR:
// You can also use ToAscii()+GetKeyboardState() to retrieve characters.
if (wParam > 0 && wParam < 0x10000)
io.AddInputCharacter((unsigned short)wParam);
return true;
}
return 0;
}
示例14: HandleMouseScrollEvents
void HandleMouseScrollEvents(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LPSCROLLSTATE state)
{
SCROLLINFO si;
int Delta;
int NewPos;
si.cbSize = sizeof(si);
si.fMask = SIF_PAGE;
GetScrollInfo(hWnd, SB_VERT, &si);
if (Globals.uLinesToScroll == WHEEL_PAGESCROLL)
{
NewPos = si.nPage;
}
else
{
NewPos = Globals.uLinesToScroll * 5;
}
if (GET_WHEEL_DELTA_WPARAM(wParam) > 0)
{
NewPos = state->CurrentY - NewPos;
}
else
{
NewPos = state->CurrentY + NewPos;
}
NewPos = min(state->MaxY, max(0, NewPos));
if (NewPos == state->CurrentY)
{
return;
}
Delta = NewPos - state->CurrentY;
state->CurrentY = NewPos;
ScrollWindowEx(hWnd, 0, -Delta, NULL, NULL, NULL, NULL, SW_INVALIDATE);
si.cbSize = sizeof(si);
si.fMask = SIF_POS;
si.nPos = state->CurrentY;
SetScrollInfo(hWnd, SB_VERT, &si, TRUE);
}
示例15: GET_WHEEL_DELTA_WPARAM
BOOL CMouseWheelMgr::OnMouseEx(UINT uMouseMsg, const MOUSEHOOKSTRUCTEX& info)
{
if (uMouseMsg == WM_MOUSEWHEEL)
{
HWND hwndPt = ::WindowFromPoint(info.pt);
int zDelta = GET_WHEEL_DELTA_WPARAM(info.mouseData);
if (info.hwnd != hwndPt) // does the window under the mouse have the focus.
{
// modifier keys are not reported in MOUSEHOOKSTRUCTEX
// so we have to figure them out
WORD wKeys = 0;
if (GetKeyState(VK_CONTROL) & 0x8000)
wKeys |= MK_CONTROL;
if (GetKeyState(VK_SHIFT) & 0x8000)
wKeys |= MK_SHIFT;
if (GetKeyState(VK_LBUTTON) & 0x8000)
wKeys |= MK_LBUTTON;
if (GetKeyState(VK_RBUTTON) & 0x8000)
wKeys |= MK_RBUTTON;
if (GetKeyState(VK_MBUTTON) & 0x8000)
wKeys |= MK_MBUTTON;
::PostMessage(hwndPt, WM_MOUSEWHEEL, MAKEWPARAM(wKeys, zDelta), MAKELPARAM(info.pt.x, info.pt.y));
return TRUE; // eat
}
else // special cases not natively supporting mouse wheel
{
CString sClass = CWinClasses::GetClass(hwndPt);
if (CWinClasses::IsClass(sClass, WC_DATETIMEPICK) ||
CWinClasses::IsClass(sClass, WC_MONTHCAL))
{
::PostMessage(hwndPt, WM_KEYDOWN, zDelta > 0 ? VK_UP : VK_DOWN, 0L);
}
}
}
// all else
return FALSE;
}