Click here to Skip to main content
14,668,708 members
Rate this:
Please Sign up or sign in to 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.
Posted
Updated 6-Jul-19 8:58am
v3
Comments
   
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.
—SA
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.

—SA
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.
—SA
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 this.it's my mistake. thanks for your remind.
English is not my mother language,I am trying to improve!
   
Very good, thank you for understanding.
—SA
   
The question makes no sense at all. PostMessage does not return any value, and this "formula" is a total gibberish.
—SA
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.
—SA
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

Rate this:
Please Sign up or sign in to vote.

Solution 1

havent you read the msdn? :mad:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms645616(v=vs.85).aspx[^]


They is written:

Quote:
lParam
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.
   
Comments
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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100