Passing Pointers to DLL


Attention! 👉Starting November 2024, BlitzCoder.org will now be BlitzBasic.org.

 

Tweet blitz3d memory code-archives tutorials
BlitzCoder

This is a basic example on how to pass pointers to DLL using banks and peek commands. You need the User32 decls to test the example below which retrieves the mouse x y position on your whole desktop screen.

The win32 api function below requires a pointer as parameter so this is how blitz3d handles it.

Graphics 800,600,0,2

lpPoint = CreateBank(8);big enough to handle two integers

While Not KeyHit(1) 

Cls
result = api_GetCursorPos%(lpPoint)
If result = 1 ;if it worked
   x = PeekInt(lpPoint,0)
   y = PeekInt(lpPoint,4)
End If

Text 10,10,"X: " +x + ", Y: "+y

Wend 

FreeBank lpPoint

Reply To Topic (minimum 10 characters)

Please log in to reply