Skip to main content
GameDev.net gamedev.net
🔒 Locked

help please on wheelmouse

Started by 31337noob Apr 23, 2004 at 1:55 PM 24 replies 1.8k views
Original Post
31337noob
31337noob
in c++, how do you find out which way you scrolled the wheel? i know i use WM_MOUSEWHEEL to detect if the wheel was scrolled but how do i find out which direction i scrolled it? please help. thank you.
SoulSpectre
SoulSpectre
From microsoft:
wParam
The high-order word indicates the distance the wheel is rotated, expressed in multiples or divisions of WHEEL_DELTA, which is 120. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user.

zDelta = GET_WHEEL_DELTA_WPARAM(wParam);

antareus
antareus
Use MSDN. I don''t see how someone can program for Win32 without it.
--God has paid us the intolerable compliment of loving us, in the deepest, most tragic, most inexorable sense.- C.S. Lewis
31337noob
31337noob
error C2065: ''GET_WHEEL_DELTA_WPARAM'' : undeclared identifier
31337noob
31337noob
so how would i do it or what do i need to include besides zmouse.h?
31337noob
31337noob
i used it and i still get the same error.
thats why i am asking you guys for help.

so how would i do it.

or give me an example.
31337noob
31337noob
by the way i used the msdn and it did not help for what i need.
SoulSpectre
SoulSpectre
short GET_WHEEL_DELTA_WPARAM(
WPARAM wParam
);

Parameters:

wParam ''Specifies the value to be converted.

Return Value:

The return value is the high-order word representing the wheel-delta value. It indicates the distance that the wheel is rotated, expressed in multiples or divisions of WHEEL_DELTA, which is 120. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user.

Header: Declared in Winuser.h, include Windows.h
31337noob
31337noob
hello????
i already read that and it did not work.
31337noob
31337noob
i dont know.

what i have is.

and i have #include <windows.h> and zmouse.h


case WM_MOUSEWHEEL:
{
int zDelta = GET_WHEEL_DELTA_WPARAM(wParam);

if(weap == 1)
{
weap = 0;
break;
}
if(weap == 0)
{
weap = 1;
break;
}
}
break;


[edited by - 31337noob on April 23, 2004 3:19:20 PM]
31337noob
31337noob
and it does not work it says
error C2065: ''GET_WHEEL_DELTA_WPARAM'' : undeclared identifier
SoulSpectre
SoulSpectre
Have you actually got the wparam variable parsed/initialised in that function? list the complete function in a source block please.
CodeMunkie
CodeMunkie
You didn''t #define WIN32_LEAN_AND_MEAN by chance? As mentioned, you can also just use HIWORD(wParam) (also mentioned on the same MSDN page as WM_MOUSEWHEEL wink wink).
"When you die, if you get a choice between going to regular heaven or pie heaven, choose pie heaven. It might be a trick, but if it's not, mmmmmmm, boy."
How to Ask Questions the Smart Way.
31337noob
31337noob

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_DESTROY:
mouse.killgui();
g[0].killgui();
g[1].killgui();
g[2].killgui();
g[3].killgui();
g[4].killgui();
g2[0].killgui();
g2[1].killgui();
g2[2].killgui();
g2[3].killgui();
g2[4].killgui();
g3[0].killgui();
g3[1].killgui();
g3[2].killgui();
g3[3].killgui();
g3[4].killgui();
g4[0].killgui();
g4[1].killgui();
g4[2].killgui();
g4[3].killgui();
g4[4].killgui();
b[0].killgui();
b[1].killgui();
b[2].killgui();
b[3].killgui();
b[4].killgui();
b2[0].killgui();
b2[1].killgui();
b2[2].killgui();
b2[3].killgui();
b2[4].killgui();
b3[0].killgui();
b3[1].killgui();
b3[2].killgui();
b3[3].killgui();
b3[4].killgui();
b4[0].killgui();
b4[1].killgui();
b4[2].killgui();
b4[3].killgui();
b4[4].killgui();
m[0].killgui();
m[1].killgui();
m[2].killgui();
m[3].killgui();
bullet.killgui();
bullet2.killgui();
//background.killgui();


if(myhealth <= 0)
{
MessageBox(0,"you died","end",0);
}

expl[0].killgui();
expl[1].killgui();
expl[2].killgui();

PostQuitMessage(0);
break;

case WM_MOUSEWHEEL:
{
int zDelta = GET_WHEEL_DELTA_WPARAM(wParam);

if(weap == 1)
{
weap = 0;
break;
}
if(weap == 0)
{
weap = 1;
break;
}
}
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
SoulSpectre
SoulSpectre
error C2065:
Omitting necessary include files, especially if you define VC_EXTRALEAN, WIN32_LEAN_AND_MEAN, or WIN32_EXTRA_LEAN. These symbols exclude some header files from windows.h and afxv_w32.h to speed compiles. (Look in windows.h and afxv_w32.h for an up-to-date description of what''s excluded.)
31337noob
31337noob
i tryed #define WIN32_LEAN_AND_MEAN
and it still didnt work.

it still says
error C2065: ''GET_WHEEL_DELTA_WPARAM'' : undeclared identifier
SoulSpectre
SoulSpectre
Dude, if the hiword macro doesn''t work then you got some issues with your program, check your windows.h, and winuser.h files for the macro/functions, check what #ifdef blocks they are in etc.
Also check your build env and make sure you don''t have mean and lean defined etc.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.