Win API; GetCursorPos

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.

Can anybody tell me why this not works? Is something missing?

Structure pt
x.l
y.l
EndStructure

Dim Cursor.pt(8)
GetCursorPos_(Cursor)
xPos$=str(Cursor(0)\x)
yPos$=str(Cursor(4)\y)

MessageRequester("Cursor Position:",xPos$ + " , " + yPos$, 0)




Have a nice day...
Franco
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Mr.Skunk.

Here it is a correction:

Structure pt
x.l
y.l
EndStructure

Cursor.pt
GetCursorPos_(Cursor)
xPos$=str(Cursor\x)
yPos$=str(Cursor\y)

MessageRequester("Cursor Position:",xPos$ + " , " + yPos$, 0)

You don't have to create an array as in your structure x.l and y.l are Long numbers (4 bytes), the space to store the values is already reserved.

Mr Skunk

Mr Skunk's PureBasic Web Page
http://www.skunknet.fr.st
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by blueb.

Thanks Mr. Skunk

I was unsure of how to use WinAPI structures
and this helped clear that up.

Regards,
Bob
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.

Thanks a lot Mr. Skunk, that works fine.
I appreciate it very much.




Have a nice day...
Franco
Post Reply