- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using the following code to determine when the mousewheelis moving. It all works well but unfortuantely the peekmessage function continues to report mousewheel movement when there isn't any. Any movement of the mouse will cause the routine to return jdelta=0 but if you simply move the wheen and then touch nothing else it continually reports the last message.
I've tried various combinations of post message and send message but so far no joy. I'm working with opengl using the GLUT window manager if that helps.
subroutine get_mouse_wheel(hwnd, jdelta)
c
use dfwin
type (t_MSG) msg
c
jdelta=0
jreturn=peekmessage(msg,hwnd,0,0,PM_REMOVE)
if(msg.message .eq. WM_MOUSEWHEEL) then
c recognised mouswhel movement
jdelta=hiword(msg.wparam)
else
jdelta=0
end if
c
return
end
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
jreturn=PeekMessage(msg,hwnd,WM_MOUSEWHEEL,WM_MOUSEWHEEL,PM_REMOVE)because now, you're removing all messages from the queue in order to examine just one.
However, that isn't supposed to solve your problem -- I don't have an explanation to offer other than your mouse is perhaps broken?
MSDN says that "DefWindowProc propagates it up the parent chain until it finds a window that processes it." whatever that means, but it shouldn't affect your situation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No the mouse works fine - its only this application that causes the issue.
Interestingly your code change in the peekmessage made the problem worse. Previously a subsequent mouse movement reset the wheel mesage. Now no amount of mouse movement resets the message. This kind of tells me the problem is fixable - I just don't know how.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I fixed it via a hint at:
http://www.genesis3d.com/forum/viewtopic.php?topic=1003944&forum=3http://www.genesis3d.com/forum/viewtopic.php?topic=1003944&forum=3
Code that works for me is ...
subroutine get_mouse_wheel(hwnd, jdelta)
c
c
use dfwin
type (t_MSG) msg
c
jdelta=0
jreturn=peekmessage(msg,hwnd,WM_MOUSEWHEEL,WM_MOUSEWHEEL,
& PM_NOREMOVE)
if(msg.message .eq. WM_MOUSEWHEEL) then
c recognised mouswhel movement
jdelta=hiword(msg.wparam)
msg.message=0
jsend=postmessage(hwnd,WM_MOUSEWHEEL,0,0)
end if
c
return
end
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
subroutine get_mouse_wheel(hwnd, jdelta)
use dfwin
type (t_MSG) msg
jdelta=0
c Check for pending WM_MOUSEWHEEL and remove it from the queue:
if (PeekMessage(msg,hwnd,WM_MOUSEWHEEL,WM_MOUSEWHEEL,PM_REMOVE).ne.0) then
c Retrieve the value ONLY if the message had existed:
jdelta=hiword(msg.wparam)
end if
return
endIf this doesn't work, well, I promise I'll do the actual testing in a real application...
![Smiley with tongue out [:-P]](/isn/Community/en-US/emoticons/emotion-4.gif)

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page