Click here to Skip to main content
14,739,804 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
when i want to use postmessage API that send single click message,i want to know how to calculate the component's position?

i konw the forth parameter that is position,the formula is that x+y*65536。
But i don't know how to get x and y's value?
maybe i didn't explain very well,
i mean's how to get the mouse x and y coordinates in the client.
after got the x and y coordinates,how to calculate and set the forth parameter.
so that i can click somewhere that i need.
Updated 6-Jul-19 9:58am
First of all, please stop posting non-answers as "solution". It can give you abuse reports which eventually may lead to cancellation of your CodeProject membership.
Comment on any posts, reply to available comments, or use "Improve question" (above).
Also, keep in mind that members only get notifications on the post sent in reply to there posts.
xuyunhai 26-Jul-13 2:35am
you mean's that i could not modify my post,only way is improve quetion?
Why told you so? You can modify any of your posts anytime, of course.

Only you should not abuse posting. I found that you posted some content as "solutions", but those posts are not solutions. Posting via "Add your solution here" is in fact reserved for the cases when you try to help some member by responding to this member's question and giving some useful suggestion, advice, etc. You should not use it for anything else.

xuyunhai 26-Jul-13 2:51am
i understand,not only accept solution,but also post via "Add your solution here"。
Do you mean accepting your own solution, or some other one? Accepting your own I would call cheating, but no, you did not do it, which is good.
xuyunhai 26-Jul-13 3:11am
I finally understand
,i can improve question,modify my post,but not post via "Add your solution here"(non-answers as "solution"),i used did's my mistake. thanks for your remind.
English is not my mother language,I am trying to improve!
Very good, thank you for understanding.
The question makes no sense at all. PostMessage does not return any value, and this "formula" is a total gibberish.
xuyunhai 26-Jul-13 2:41am
i don't think so,
when i want to single click somewhere,
i can set the position by the forth parameter.
Then you should talk about handling of the message. How is it related to PostMessage? Anyway, you need to formulate your problem in detail. You post is hard to understand.
Stefan_Lang 26-Jul-13 2:49am
What Sergey means is that PostMessage is a function that you can call, not one that you can receive. If you call PostMessage, it will not return any value. Instead, a message will be issued to the system, and the system will forward that message to possible recipients.

So, yes, you can call PostMessage and thereby emulate the effect of clicking somewhere. But if you are interested in receiving the result of an actual click or mouse move, you must implement the corresponding event handlers for your window(s).

1 solution

havent you read the msdn? :mad:[^]

They is written:

The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.
The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

x and y are the coordinates which got the mouse click in the client.
xuyunhai 26-Jul-13 2:47am
yeah,you're right,i had seen the msdn.
but i mean's how to get the mouse x and y coordinates in the client.
maybe i didn't explain very well.
KarstenK 26-Jul-13 4:04am
google: "get mouse coordinates c++"

if you where me collegue friend: that makes a icecream or a beer ;-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900