Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8305623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:09:14+00:00 2026-06-08T18:09:14+00:00

I’m trying to learn mouse/keyboard emulation using win api. I found out that it

  • 0

I’m trying to learn mouse/keyboard emulation using win api.
I found out that it is possible to emulate button click using sendmessage() function.

Well, I get coordinates of “play” button (it is (60;100)) and trying to push this button using the following code:

            int x = 60;
            int y = 100;
            int lParam = ((x << 16) | (y & 0xffff));

            int parentWindow = FindWindow("BaseWindow_RootWnd", "Main Window");//get main winamp window
            MessageBox.Show(parentWindow.ToString());//failed if 0

            SendMessage(parentWindow, WM_LBUTTONDOWN, IntPtr.Zero, new IntPtr(lParam));//send left mouse button down
            SendMessage(parentWindow, WM_LBUTTONUP, IntPtr.Zero, new IntPtr(lParam));//send left mouse button up

But this code has no effect on the winamp.

Can anybody point me on the mistakes i made? Any help is greatly appreciated!

p.s. It’s not applicable for me to move mouse to the winamp play button, than do a click, than move it back.
Also for winamp it is impossible to get button’s handle. With button handle SendMessage() works fairly well, but with coordinates it doesn’t at all.

ADDITION #1

Well, the code above activates winamp window and shows it, if it was minimized. But play button stil don’t want to be pushed ;(

ADDITION #2

Here are messages I get after I execute the code above.

Messages in spy++

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:09:15+00:00Added an answer on June 8, 2026 at 6:09 pm

    well, to simulate mouse click in winamp window you need to do exactly what is happening when you just click it with hardware mouse. The following was found out from spy++:
    enter image description here

    So to emulate mouse click we need to:

    1. Call twice PostMessage() instead of SendMessage() because “P” in the screenshot above tells us that the message was got from the PostMessage() (according to msdn)
    2. The parameters should be the following for the first PostMessage():
      – First parameter – Winamp window handle (in our case it is 005E09FA)
      – Second parameter – the winapi code of the event, when left mouse button is down(WM_LBUTTONDOWN = 0x201)
      – Third parameter – MK_LBUTTON = 0x1 (It seems, it is necessary to pass it. It would be great if somebody can explain why)
      – Fourth parameter – Coordinates of the point where you want to press mouse button (this parameter can be calculated as following – ((Y << 16) | X))
    3. The parameters should be the following for the second PostMessage():
      – First parameter – Winamp window handle (in our case it is 005E09FA)
      – Second parameter – the winapi code of the event, when left mouse button is up (WM_LBUTTONUP = 0x202)
      – Third parameter – 0 or IntPtr.Zero
      – Fourth parameter – Coordinates of the point where you want to release mouse button (need to be as in first PostMessage() if you want your click to have an effect; this parameter can be calculated as following – ((Y << 16) | X))

    Thanks everyone for their input!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I'm making a simple page using Google Maps API 3. My first. One marker
I know there's a lot of other questions out there that deal with this
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.