C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Closed Thread
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 31st, 2012, 04:34 PM
tescrin tescrin is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2012
Posts: 14 tescrin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 24 m 32 sec
Reputation Power: 0
(CLOSED) Capturing Mouse Clicks Issue (Windows)

Hello all, my apologies if this belongs in the window's subforum; it's C++ I just couldn't decide which one it fit better.

My current code detects clicks just fine:

Code:
//this is just in a main function
  USHORT status;
  POINT mousin;
  while(true){
    status = GetAsyncKeyState(VK_LBUTTON);
    //if the button is currently down or has been pressed down 
    //since the last check (??)
    if((( ( status & 0x8000 ) >> 15 ) == 1) || (( status & 1 ) == 1)){
      GetCursorPos(&mousin);
      cout << "Detected a mouse press at "
           << mousin.x << " "
           << mousin.y << " "
           << endl;
      
      //When detected, we need to eat all the other detected messages
      while((((( status & 0x8000 ) >> 15 ) == 1) || (( status & 1 ) == 1)))
        status = GetAsyncKeyState(VK_LBUTTON);
    }
  }


The issue is that when I gobble up those extra "detected" messages it starts to really mess with other programs as they don't seem to get the "released" signal at the end of the mouse click. I imagine there's a better way to eat those signals in the second while loop.

If someone could tell me why this is doing this so I could have it run in the background that'd be spectacular! I'm attempt to mouse-log in order to help me to create automated GUI tests out of actual manual tests.


EDIT: I added a Sleep(100) message at the beginning. The issue seems to have been the granularity at which I was checking. I had tried other sleep statements but decided to keep messing with it.

Reply With Quote
Closed Thread

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Capturing Mouse Clicks Issue (Windows)

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap