PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: jermy on October 02, 2016, 04:28:31 PM

Title: Passing different pointer types
Post by: jermy on October 02, 2016, 04:28:31 PM
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
Title: Re: Passing different pointer types
Post by: José Roca on October 02, 2016, 04:46:50 PM
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))

Title: Re: Passing different pointer types
Post by: jermy on October 02, 2016, 04:56:01 PM
Thanks Jose,