Announcement

Collapse
No announcement yet.

Graphic Screen Mouse Cursor Location

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #41
    >There is a cautionary note to add. Mousepoint.x and Mousepoint.y are DWORD's...

    Source of "Mousepoint" ??? Firefox could not find on this page.

    Not found in PBCC 6 help or my WinAPI reference, either.
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


      #42
      Michael, in the second post of this thread we have
      Code:
      DIM MousePoint AS POINTAPI
      and in WinDef.inc we have
      Code:
      TYPE POINT
          x AS LONG
          y AS LONG
      END TYPE
      
      ' [PowerBASIC legacy]
      TYPE POINTAPI
          POINT
      END TYPE
      I don't see how the MousePoint.x or MousePoint.y are DWORDs. Unless I missed another instance of the declaration.
      Rod
      In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.

      Comment


        #43
        > I don't see how the MousePoint.x or MousePoint.y are DWORDs.

        That was my issue, too.

        (But I only did 'find' on this page)


        FWIW, MSDN says..
        Code:
        typedef struct tagPOINT { 
          LONG x; 
          LONG y; 
        } POINT, *PPOINT;
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


          #44
          In my haste, I wasn't too clear. You have to look at Valdes' program (the 6th post this thread):
          Code:
          #COMPILE EXE
          #CONSOLE OFF
          #DIM ALL
          
          #INCLUDE "WIN32API.INC"
          
          GLOBAL hvin AS LONG
          
          FUNCTION PBMAIN () AS LONG
          DIM MousePoint AS POINTAPI
          LOCAL hWin AS LONG
          GRAPHIC WINDOW "Cursor Position",0,0,800,600 TO hwin
          GRAPHIC ATTACH hWin, 0, REDRAW
          hvin=1
          DO
          SLEEP 20
          IF hvin=0 THEN EXIT LOOP
          GRAPHIC GET DC TO hvin
          GetCursorPos Mousepoint
          ScreenToClient hWin,mousepoint
          GRAPHIC SET POS (20,20)
          GRAPHIC PRINT "X: ";Mousepoint.x;" Y: ";Mousepoint.y;" "
          GRAPHIC REDRAW
          LOOP
          GRAPHIC WINDOW END
          END FUNCTION
          If instead of
          Code:
          GRAPHIC PRINT "X: ";Mousepoint.x;" Y: ";Mousepoint.y;" "
          one codes
          Code:
          GRAPHIC PRINT "X: ";Mousepoint.x-900;" Y: ";Mousepoint.y-700;" "
          (in order to translate the cursor point to a different coordinate system, say)
          both numbers printed will be near 2^32, not negative (assuming the cursor is inside "Cursor Position" window).
          Last edited by Michael Mattias; 6 Oct 2015, 03:47 PM. Reason: Add code tags.

          Comment


            #45
            Hi Mark,

            In my system the code works OK. Maybe you are using a different or altered WIN32API.INC, in which the POINTAPI UDT is defined otherwise.

            Regards,

            Comment


              #46
              . Maybe you are using a different or altered WIN32API.INC, in which the POINTAPI UDT is defined otherwise.
              That just gave me a great new feature suggestion.... for the Source Code Bundler. at Source Code Bundler v 3 handles PB 7/8/9/10 and CC 3/4/5/6 source code

              (I already submitted this to PB but I am not holding my breath).

              WHAT IF... one of the options after gathering up all the #INCLUDE files was,"Create Single-File source code file?"

              Might be a really cool debugging tool, as it would give you ONE file with everything the compiler sees in the order it sees it. Should be a heck of a lot easier to find all those "duplicate definition" or "parameter mismatch" errors, huh?

              Maybe add it as a context menu item when you have the files list control filled?

              Hey, the source code is there, anyone could do it.
              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment

              Working...
              X
              😀
              🥰
              🤢
              😎
              😡
              👍
              👎