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 7909803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:36:15+00:00 2026-06-03T12:36:15+00:00

=) I am using C++ (not VC++) on windows7 laptop. I have a problem

  • 0

=)

I am using C++ (not VC++) on windows7 laptop.

I have a problem with this method for moving the mouse x/y from it’s current position. Every time it calls send input for a mouse event it moves the mouse but also turns off my screen (the equivalent of Fn+F2). I debugged the program and noticed that not only did mi but also ki and hi had values (this was for x=25, y=25 and absolure=false):

    mi:
      dx            25
      dy            25  
      mouseData     0   
      dwFlags       1   
      time          2686400 
      dwExtraInfo   0   
    ki:
      wVk           25  
      wScan         0
      dwFlags       25  
      time          0   
      dwExtraInfo   1   
    hi:
      uMsg          25
      wParamL       25  
      wParamH       0       

I have tried to set ki and hi to 0 but if I do that then mi is also set to 0 and then no mouse moves but the screen is still put to sleep! :$

Here are some of the methods I used.

int Controller::mouse_move(long x, long y, bool absolute) {
   mouse.dx = x;
   mouse.dy = y;

   if (absolute) {
       mouse.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE;
   }else{
       mouse.dwFlags = MOUSEEVENTF_MOVE;
   }

   mouse.mouseData = 0;
   mouse.dwExtraInfo = 0;

   input.type = INPUT_MOUSE;
   input.mi = mouse;

   SendInput(1, &input, sizeof (input));

   return 0;
}

OR

int Controller::mouse_move(long x, long y, bool absolute, int index_vector_no) {
    input.type = INPUT_MOUSE;
    input.mi.dx = x;
    input.mi.dy = y;

    if (absolute) {
        input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE;
    }else{
        input.mi.dwFlags = MOUSEEVENTF_MOVE;
    }

    input.mi.mouseData = 0;
    input.mi.dwExtraInfo = 0;

    input.ki.dwExtraInfo = 0;
    input.ki.dwFlags = 0;
    input.ki.time = 0;
    input.ki.wScan = 0;
    input.ki.wVk = 0;

    input.hi.uMsg = 0;
    input.hi.wParamH = 0;
    input.hi.wParamL = 0;

    SendInput(1, &input, sizeof (input));

    return 0;
}

Can anyone thing why this is sending keyboard input as well as mouse?! is it just something to do with my laptop configuration?

Thanks in advance! =)

  • 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-03T12:36:17+00:00Added an answer on June 3, 2026 at 12:36 pm

    The reason the others change is because they’re all in a union, so they share the same memory.

    About the screen turning off, you didn’t set mi.time to 0, so it’s uninitialized. It’s often a good idea to start initializing these structs to {0}, so you don’t forget things. The timestamp becomes some random number, which can cause a timeout on the display.

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

Sidebar

Related Questions

I have multiple databases that I connect to using SQL*Plus in Windows (not the
I have created a process using proc-open but under windows the stream-select does not
When not using areas dealing with the url for the JsonResults from the clientside
I am not using github. We have git setup on our machine. I created
I'm not using LINQ-to-SQL or Entity Framework bits in a web app, and have
I have the following problem. I use an old Windows XP laptop as some
I'm interested in using F# for numerical work, but my platforms are not windows
I'm creating a Windows app that automatically updates itself. I'm not using ClickOnce for
Using css (not a inline one, but external stylesheet) how do i override the
I'm not using hibernate and that's not a valid alternative at all. I developed

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.