The get_mouse_info@ and the clearwin_info@ equivalent methods only provides the shift and control information if a mouse button is pressed prior to and held during the mouse wheel action. The states can be obtained at any time, see code below. I have shown it called from within one of my mouse wheel callback routines to show the information is available, but I only print the info.
Integer*4 function OnMouseWheel()
implicit real*8 (a-h,o-z)
include <windows.ins>
include 'params.inc'
include 'drawtool.inc'
include 'f77pcs.for'
integer*4 wheel_rot,wparam,zoom_back,zoom_in
c and get the wheel scroll values from WPARAM in OnMouseWheel:
OnMouseWheel = 2
if(mod(idraw_mode,2) .eq.0)then !Normal P&ID window
wparam = clearwin_info@('MESSAGE_WPARAM')
wheel_rot = HIWORD@(wparam) / 120 ! rotations reported as *120
call set_zoom_factor(sqrt(sqrt(2d0)))
if(wheel_rot .eq. 1)then
i = zoom_in()
elseif(wheel_rot .eq. -1)then
i = zoom_back()
endif
call set_zoom_factor(sqrt(2d0))
i = i
endif
print *,modkeystates()
end
integer*4 function modkeystates()
! get states of shift, control and alt modifier keys - not left right dependent
include <windows.ins>
integer*4 test_bit@
integer*1 key_shift,key_control,key_alt
key_shift = GetKeyState(VK_SHIFT)
key_control = GetKeyState(VK_CONTROL)
key_alt = GetKeyState(VK_MENU)
modkeystates = test_bit@(key_shift,7) +
& test_bit@(key_control,7)*2 +
& test_bit@(key_alt,7) *4
end
integer*4 function modkeystates1()
! get states of shift, control and alt modifier keys - left & right dependent
! bits 0 to 2 are identical to non-handed version
! bits 3 to 5 are left hand sensitive
! bits 6 to 8 are right hand sensitive
include <windows.ins>
integer*4 test_bit@
integer*1 key_lshift,key_lcontrol,key_lalt
integer*1 key_rshift,key_rcontrol,key_ralt
key_lshift = GetKeyState(VK_LSHIFT)
key_lcontrol = GetKeyState(VK_LCONTROL)
key_lalt = GetKeyState(VK_LMENU)
key_rshift = GetKeyState(VK_RSHIFT)
key_rcontrol = GetKeyState(VK_RCONTROL)
key_ralt = GetKeyState(VK_RMENU)
modkeystates1 = modkeystates() +
& test_bit@(key_lshift,7) * 8 +
& test_bit@(key_lcontrol,7)* 16 +
& test_bit@(key_lalt,7) * 32 +
& test_bit@(key_rshift,7) * 64 +
& test_bit@(key_rcontrol,7)*128 +
& test_bit@(key_ralt,7) *256
end