Page 1 of 1
Posted: Sun Sep 22, 2002 2:42 pm
by BackupUser
Restored from previous forum. Originally posted by crown.
does someone know how to read the mouse position
when the mouse is on the desktop ?
maybe it is very simple , but i'm a biginner
(registered PureBasic user)
Posted: Sun Sep 22, 2002 3:46 pm
by BackupUser
Restored from previous forum. Originally posted by Pupil.
Originally posted by crown
does someone know how to read the mouse position
when the mouse is on the desktop ?
maybe it is very simple , but i'm a biginner
I think that you have to use the WIN API at this time to get the position. Something like this:
GetCursorPos_(@Coordinate.POINT)
xpos = Coordinate\x ; x pos of mouse cursorypos = Coordinate\y ; y pos of mouse cursor
Posted: Sun Sep 22, 2002 3:48 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
> does someone know how to read the mouse position
If your app is just for Windows (and not Amiga/Linux), you can do this:
GetCursorPos_(mouse.POINT) : x=mouse\x : y=mouse\y
The variables x and y will then hold the current co-ordinates.
PB - Registered PureBasic Coder
Posted: Sun Sep 22, 2002 3:50 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
Dammit Pupil -- you beat my post by 2 seconds!
At least the answers come thick and fast here!
PB - Registered PureBasic Coder
Posted: Sun Sep 22, 2002 4:13 pm
by BackupUser
Restored from previous forum. Originally posted by crown.
thanks for the fast reply guys....
(registered PureBasic user)
Posted: Sun Sep 22, 2002 4:16 pm
by BackupUser
Restored from previous forum. Originally posted by Pupil.
Originally posted by PB
Dammit Pupil -- you beat my post by 2 seconds!
At least the answers come thick and fast here!
I'll let you win next time

Posted: Mon Sep 23, 2002 2:51 pm
by BackupUser
Restored from previous forum. Originally posted by freak.
No API needed herer, guys...
x = WindowX() + WindowMouseX()
y = WindowY() + WindowMouseY()
Works fine...
Timo
Posted: Mon Sep 23, 2002 3:48 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
> x = WindowX() + WindowMouseX()
> y = WindowY() + WindowMouseY()
> Works fine...
Only works if your app actually has a window.
PB - Registered PureBasic Coder
Posted: Mon Sep 23, 2002 4:09 pm
by BackupUser
Restored from previous forum. Originally posted by freak.
OpenWindow(0, 0, 0, 0, 0, #PB_Window_Invisible, "")

Posted: Mon Sep 23, 2002 4:37 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
> OpenWindow(0, 0, 0, 0, 0, #PB_Window_Invisible, "")
Yeah I know.

And it's a good way to ensure your app works with the
Amiga/Linux versions of PureBasic too. But if you're just coding for
Windows, then using the API will save you both memory and exe size:
Code: Select all
; Creates exe size of 12,320 bytes.
OpenConsole()
OpenWindow(0,0,0,0,0,#PB_Window_Invisible,"")
x=WindowX()+WindowMouseX() : y=WindowY()+WindowMouseY()
PrintN(Str(x)) : PrintN(Str(y)) : Input() : End
;
; Creates exe size of 7,200 bytes.
OpenConsole()
GetCursorPos_(mouse.POINT) : x=mouse\x : y=mouse\y
PrintN(Str(x)) : PrintN(Str(y)) : Input() : End
PB - Registered PureBasic Coder
Posted: Mon Sep 23, 2002 5:26 pm
by BackupUser
Restored from previous forum. Originally posted by fred.
I will really split the window library to put a final word over API vs PB functions
Fred - AlphaSND
Posted: Mon Sep 23, 2002 7:54 pm
by BackupUser
Restored from previous forum. Originally posted by Danilo.
You cant. We could use 5k Dialogs without your big
event-handler.
cya,
...Danilo
(registered PureBasic user)
Posted: Mon Sep 23, 2002 10:54 pm
by BackupUser
Restored from previous forum. Originally posted by fred.
Danilo: you're challenging me

. Let's see If I can do a 5 ko app with a window and a gadget...
Fred - AlphaSND