• Welcome to PlanetSquires Forums.
 

Passing different pointer types

Started by jermy, October 02, 2016, 03:58:31 PM

Previous topic - Next topic

jermy

Hello all,

The FB Compiler tells me;
warning 3(1): Passing different pointer types, at parameter 1 of GETCURSORPOS()



Type Point_Api
  X as Long
  Y as Long
End Type

                         Dim lngRetVal            as Long
                         Dim ptScreenCursorPos    as Point_Api     
                         
                             lngRetVal = GetCursorPos(@ptScreenCursorPos)



I can't figure it out why the Compiler keeps whining.

Jermy

José Roca

It complains because you're passing a pointer to a Point_Api structure to a function that expects a pointer to a POINT structure.

Either use


Dim lngRetVal as Long
Dim ptScreenCursorPos as POINT
lngRetVal = GetCursorPos(@ptScreenCursorPos)


or cast your type variable to the expected type:


lngRetVal = GetCursorPos(cast(POINT PTR, @ptScreenCursorPos))


jermy