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

  • SEARCH
  • Home
  • 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 6750925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:51:58+00:00 2026-05-26T12:51:58+00:00

I am writing a small program to emulate the mouse with my Xbox 360

  • 0

I am writing a small program to emulate the mouse with my Xbox 360 controller. I have successfully implemented movement of the cursor but am having difficulty with clicks.

Here is a snippet of my code:

while (msg.message != WM_QUIT) {
    if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    } else {

        ...           

        if (state.Gamepad.wButtons & XINPUT_GAMEPAD_A) {
            PostMessage(HWND_BROADCAST, WM_LBUTTONDOWN, 0, MAKEWORD(new_x, new_y));
        }

        ...       
    }
}

I’m not 100% sure this is the right approach but I’m trying to send the WM_LBUTTONDOWN message to all top-level windows when the A button is pressed. But when I place the mouse over say, a button and press A, the button flashes as if it was clicked but then nothing happens.

If anyone can point me in the right direction or offer an alternative way to do this I’d be very grateful!

  • 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-05-26T12:51:58+00:00Added an answer on May 26, 2026 at 12:51 pm

    I think, instead of PostMessage, you’d rather use the mouse_event API or even SendInput. It allows you to synthesise mouse events on a more abstract level.

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

Sidebar

Related Questions

I'm writing a small program to calculate a physics problem but I'm having problems
in small program I'm writing, I have to parse a line of user input.
I am writing a small program in OpenGL on my Mac. I have a
I'm writing a small ruby program to play with Twitter over OAuth and have
I'm writing a small program to record reading progress, the data models are simple:
I am writing a small program for our local high school (pro bono). The
I'm pretty new to C# and Visual Studio. I'm writing a small program that
I am writing a small computation program with lot of read operations on blob
I have an application where I am reading and writing small blocks of data
I'm writing a small program to read in a csv with a variable number

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.