Silverfrost Forums

Welcome to our forums

Replacing GET_MOUSE_POSITION with CLEARWIN_INFO

13 Feb 2024 9:46 #31096

I'm upgrading a suite of programs from 32-bit to compile in 64-bit. While in 32-bit, I have been upgrading a call to GET_MOUSE_POSITION (which has not been made available in clearwin64) to CLEARWIN_INFO. For clarity, I've upgraded the calling routine to call either of the following two routines...

      SUBROUTINE GET_MOUSE_POSITION_OLD (IHOUT7, IVOUT7, IBS7)
C
      USE mswin$
C
      INTEGER(KIND=7) IHOUT7, IVOUT7, IBS7
      INTEGER*2 IHOUT2, IVOUT2, IBS2
C      
      INTEGER(KIND=7) EBS7(1)
      INTEGER*2 EBS2(4)
      EQUIVALENCE (EBS7,EBS2)
C
      CALL GET_MOUSE_POSITION$ (IHOUT2, IVOUT2, IBS2)
      IHOUT7 = IHOUT2
      IVOUT7 = IVOUT2
      EBS7(1) = 0
      EBS2(1) = IBS2
      IBS7 = EBS7(1)
C
      RETURN
C
C     END OF SEGMENT GET_MOUSE_POSITION_OLD
C
      END
C
C
C
      SUBROUTINE GET_MOUSE_POSITION_NEW (IHOUT7, IVOUT7, IBS7)
C
      USE mswin$
C
      INTEGER(KIND=7) IHOUT7, IVOUT7, IBS7
C
      IHOUT7 = CLEARWIN_INFO$ ('GRAPHICS_MOUSE_X')
      IVOUT7 = CLEARWIN_INFO$ ('GRAPHICS_MOUSE_Y')
      IBS7 = CLEARWIN_INFO$ ('GRAPHICS_MOUSE_FLAGS')
C
      RETURN
C
C     END OF SEGMENT GET_MOUSE_POSITION_NEW
C
      END

Using the first subroutine (_OLD), the software works fine, with the X,Y and FLAGS operating correctly.

With the second subroutine called (_NEW) it fails with the X,Y,FLAGS all being zero.

Interestingly, if I call the _NEW one immediately after the _OLD one, it returns the SAME values. Is this because the CLEARWIN_INFO returns the information at the time of the last call back, whereas GET_MOUSE_POSITION is continuous (ie effectively initiates its own call back)?

This bears a large resemblance to the following post by GEWV, Posted: Tue Nov 26, 2013 9:59 am Post subject: get_mouse_position That post doesn't offer a simple solution, like forcing the CLEARWIN_INFO to refresh which is what I would have hoped for, though PaulLaidler did suggest that get-mouse-position could be considered fo 64-bit. This routine is highly embedded in a whole suite of programs, and doesn't lend itself to a change in structure.

13 Feb 2024 10:22 #31098

get_mouse_position@ is exported by clearwin64.dll and can be accessed using

INCLUDE <dbos.ins>

or

      C_EXTERNAL GET_MOUSE_POSITION@ '__get_mouse_position'(REF,REF,REF)
13 Feb 2024 10:39 #31099

For GRAPHICS_MOUSE_X etc. you will need the option [full_mouse_input] for the related graphics region.

14 Feb 2024 8:36 #31108

Thanks Paul, that appears to work.'

Please login to reply.