Advertisement
4_2005-2006 Windows API Call/ Explanation #149778

Detect Idle Mouse (GetCursorPos)

This code can be used to determine the X,Y coordinates of the mouse cursor and use them to check for idle mouse activity. This code is useful in that it does not require your current form to be in focus (active windows status). The GetCursorPos can be used in conjunction with or be replaced by another API call GetCaretPos, which determines the X,Y coordinates of the text cursor. Hopefully this will be useful to anyone looking to check for an idle desktop. (Richard Puckett, puckettr@mindspring.com)

AI

Podsumowanie AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Kod źródłowy
original-source
Public Sub Form_Load()
  
  Timer1.Interval = 1000
  
  OldX = 0
  OldY = 0
    
End Sub
Public Sub Timer1_Timer()
             
  GetCursorPos Pnt
           
    Me.Cls
    Me.Print "The current mouse coordinates are "; _
    Pnt.X; ","; Pnt.Y
    
  NewX = Pnt.X
  NewY = Pnt.Y
    
    Me.Print "OldX coords", OldX
    Me.Print "OldY coords", OldY
        
    Me.Print "NewX coords", NewX
    Me.Print "NewY coords", NewY
       
    If OldX - NewX = 0 Then
      Me.Print "No Movement Detected"
      TimeExpired = TimeExpired + Timer1.Interval
      Me.Print "Total Time Expired", TimeExpired
    Else
      Me.Print "Mouse is Moving"
      TimeExpired = 0
    End If
   
  OldX = NewX
  OldY = NewY
    
    ExpiredMinutes = (TimeExpired / 1000) / 60
    
    If ExpiredMinutes >= MINUTES Then
    TimeExpired = 0
    Me.Print "Times Up!!!"
    
    End If
End Sub

<?php
//       (( Script Written By Kyle Shannon ))
// ((           www.myownpill.com            ))
// __________________________________________________________________________
// Instructions
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// CHMOD iplog.txt to 777
// Put this script inside a .php file on your site
// For each person who visits their IP address will be logged in the iplog.txt
// __________________________________________________________________________
// The Code
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// 
$td = date("F jS");
 $ip = $REMOTE_ADDR; // Set the variable as their ip address
 $fh = fopen("iplog.txt",'a+'); // Open the text file and tell it to add
  fputs($fh, "$ip : $td<br><br>"); // Add the ip address onto the next line
  fclose($fh); // Close the text file
// 
// __________________________________________________________________________
// End Code
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// 
?>
Oryginalne komentarze (3)
Odzyskane z Wayback Machine