PDA

View Full Version : need help about WM_MOUSEMOVE



agemenon
03-04-2005, 05:35 PM
Can anybody tell me how do i get difference of current and the previous position of the wheel.
From the msdn I have checked and found GET_WHEEL_DELTA_WPARAM Macro but i can't use it.
Compiler says "GET_WHEEL_DELTA_WPARAM : undeclared identifier"
I also included windows.h and i am sure that
case WM_MOUSEMOVE: works well.
What i am trying to do is to set the A value in
gluPerspective(A,(GLfloat)width/(GLfloat)height,0.1f,100.0f);
function. I am trying to zoom in - out by changing A value. Am I on the right way...
Thanx

Silkut
03-05-2005, 01:04 AM
Hm, personally when i'm sure that the header is included and that normally works I suspect a mistakes in declaration, I suppose that your source is to big to be posted...?

agemenon
03-05-2005, 03:34 AM
This is my wndproc function and problem here is
GET_WHEEL_DELTA_WPARAM(wParam); doesn't work
in case WM_MOUSEWHEEL

LRESULT CALLBACK WndProc( HWND hWnd, // Handle For This Window
UINT uMsg, // Message For This Window
WPARAM wParam, // Additional Message Information
LPARAM lParam) // Additional Message Information
{
switch (uMsg) // Check For Windows Messages
{
case WM_ACTIVATE: // Watch For Window Activate Message
{
if (!HIWORD(wParam)) // Check Minimization State
{
active=TRUE; // Program Is Active
}
else
{
active=FALSE; // Program Is No Longer Active
}

return 0; // Return To The Message Loop
}

case WM_SYSCOMMAND: // Intercept System Commands
{
switch (wParam) // Check System Calls
{
case SC_SCREENSAVE: // Screensaver Trying To Start?
case SC_MONITORPOWER: // Monitor Trying To Enter Powersave?
return 0; // Prevent From Happening
}
break; // Exit
}

case WM_CLOSE: // Did We Receive A Close Message?
{
PostQuitMessage(0); // Send A Quit Message
return 0; // Jump Back
}

case WM_KEYDOWN:
//Keyboard_Input();
switch(wParam)
{
case VK_ESCAPE:
PostQuitMessage(0);
break;
}
break;

case WM_KEYUP: // Has A Key Been Released?
{
keys[wParam] = FALSE; // If So, Mark It As FALSE
return 0; // Jump Back
}

case WM_SIZE: // Resize The OpenGL Window
{
ReSizeGLScene(LOWORD(lParam),HIWORD(lParam)); // LoWord=Width, HiWord=Height
return 0; // Jump Back
}

case WM_MOUSEMOVE: // Mouse Move
{
// int xPos = GET_X_LPARAM(lParam);
// int yPos = GET_Y_LPARAM(lParam);
objCamera.Mouse_Move(640, 480);
return 0; // Jump Back
}
case WM_MOUSEWHEEL:
{
short zDelta = GET_WHEEL_DELTA_WPARAM(wParam);

return 0;
}



}


// Pass All Unhandled Messages To DefWindowProc


return DefWindowProc(hWnd,uMsg,wParam,lParam);
}

ce110ut
03-05-2005, 08:15 PM
not to sound like a jerk, but doesn't this belong in the windows-specific thread maybe?

Silkut
03-06-2005, 01:13 AM
yes it can be

agemenon
03-09-2005, 07:40 AM
I found what i am asking
I wrote
short zDelta = (wParam / 65536);
in case WM_MOUSEWHEEL
so i get zDelta as 120 positive or negative according to wheel rotation.