By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,264 Members | 1,220 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,264 IT Pros & Developers. It's quick & easy.

C# Send Mouseclick to Window

P: 39
Is there a way to send mouseclick to an inactive window? My guess would be to use the Win32 API function PostMessge(). I tried to do this and it seems like that it may be sending the mouse click but I think the coordinates are with respect to the top left of the desktop and not the top left of the hWnd that I send as a parameter.
Feb 1 '09 #1
Share this Question
Share on Google+
2 Replies

Expert 5K+
P: 7,872
I think you might be correct?
You will probably have to dig around for functions that tell you were the window is and do some conversions then?

Can you devise a test setup to find out what itse doing?
Perhaps make a program with a single form that registers mouse clicks and displays their coordinates.
Then you could post your click message to it and see where it thinks the mouse is clicking?
Feb 2 '09 #2

P: 39
So apparently the coordinates that you supply in PostMessage() are with respect to the hWnd that you also supply. I just was supplying bad coordinates for the click because of a typo.
Feb 3 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.