Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (kzhao, AndrewAMD, bigsmack, 7th_zorro), 869 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Setting mouse position #252072
02/16/09 10:05
02/16/09 10:05
Joined: Dec 2008
Posts: 271
Saturnus Offline OP
Member
Saturnus  Offline OP
Member

Joined: Dec 2008
Posts: 271
Hello,

to set the mouse position via the API function SetCursorPos() in the engine window poperly (window mode), I need to know the position of the window. I'm using window_pos for this.

However, when using SetCursorPos() the mouse is displaced by some pixels, because the caption area and the borders of the window are not considered (in my code).

Does somebody know how I can solve this?
Perhaps sys_metrics() will do the trick (for calculating height and width of the window borders), but I don't know what system parameters are relevant for this.

Thanks

Re: Setting mouse position [Re: Saturnus] #252083
02/16/09 11:12
02/16/09 11:12
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
sys_metrics:

Quote:

SM_CXBORDER 5 Width and height of a window border, in pixels. This is equivalent to the SM_CXEDGE value for windows with the 3-D look.
SM_CYBORDER 6

SM_CYMENU 15 Height of a single-line menu bar, in pixels.

SM_CXFRAME 32 Thickness of the sizing border around the perimeter of a window that can be resized, in pixels. SM_CXSIZEFRAME is the width of the horizontal border, and SM_CYSIZEFRAME is the height of the vertical border.
SM_CYFRAME 33


I guess thats all you need.

Re: Setting mouse position [Re: Xarthor] #252088
02/16/09 11:31
02/16/09 11:31
Joined: Dec 2008
Posts: 271
Saturnus Offline OP
Member
Saturnus  Offline OP
Member

Joined: Dec 2008
Posts: 271
Thank you! SM_CXSIZEFRAME was the parameter I've missed in the first place. smile

With the following combination of parameters it seems to work fine:
Code:
SetCursorPos(window_pos.x + pie_menu->x + sys_metrics(SM_CYSIZEFRAME),
             window_pos.y + pie_menu->y + sys_metrics(SM_CYMENU) + sys_metrics(SM_CXSIZEFRAME));


Re: Setting mouse position [Re: Saturnus] #252126
02/16/09 17:49
02/16/09 17:49
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
dont know but didnt you swichted y and x in sm_cysizeframe


"empty"
Re: Setting mouse position [Re: flits] #252178
02/16/09 22:25
02/16/09 22:25
Joined: Dec 2008
Posts: 271
Saturnus Offline OP
Member
Saturnus  Offline OP
Member

Joined: Dec 2008
Posts: 271
Yes, thank you.
Propably the width and height of the borders are equal, so I didn't notice.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1