I am using a DirectInput framework that I downloaded to study.
Everything in it works correctly except for the following function.
POINT DirectInput::DIMouseHandler(void)
{
POINT p;
HRESULT hr;
//Clear out the mouse structure
memset(&m_diMouseState, 0, sizeof(m_diMouseState));
//Get the scoop from the mouse
if(FAILED(hr = m_diMouse->GetDeviceState(sizeof(m_diMouseState),(LPVOID)
&m_diMouseState)))
{
//Maintain control of mouse
if(hr == DIERR_INPUTLOST)
m_diMouse->Acquire();
}
p.x = m_diMouseState.lX;
p.y = m_diMouseState.lY;
return p;
}
Everything runs fine to it's call, and the compiler never complains.
However, when I start the app Vista immediately tells me the program hit a
fatal error.
This is how I try to use it.
POINT mousePos = g_pDI->DIMouseHandler();
OR
POINT mousePos = (g_pDI->DIMouseHandler());
//Attempt to use mousePos.x and mousPos.y
Commenting that call makes the program run smoothly again, (minus the mouse
of course)
I'm a novice, so I'm out of ideas. What did I miss?
where is g_pDI initialized?
what does the debugger show when you examine these variables at runtime by
stepping into the program?
"zyrolasting" <zyrol...@discussions.microsoft.com> wrote in message
news:B3B1063C-9D63-4847...@microsoft.com...