| |

Fortgeschrittene ProgrammierungRe: globales event? bzw globales mouse_move | |  | Autor: ScheibeNet | Datum: 03.02.07 15:07 |
| Hallo PMan,
das ganze geht am besten mit einem SystemHook. Das selbst zu programmieren ist ziemlich aufwendig. Du benötigst für den Hook eine C-Dll.
Sehr einfach und komfortabel funktioniert es jedoch mit Spyworks von
www.desaware.com
Dazu musst du nur zwei Hooks (Maus und Tastatur) aktvieren und das wars schon. Natürlich steht dir dann die "schöne" Windowswelt offen, da du mit Spyworks ALLE Systemnachrichten überwachen kannst. Leider kostet die Lizenz 350 € (netto), aber wer gut verdienen will, muss halt auch mal investieren...
Gruss und ein schönes Wochenende
Marco
'Hier mal der "Aufwand" denn man mit Spyworks betreiben muss
Option Explicit
Dim waitloop As Boolean
Dim starttime As Date, currenttime As Date
Private Sub Command1_Click()
Dim difftime As Date
starttime = Now()
WinHook1.HookEnabled = True
WinHook2.KeyboardHook = shkKbdEntireSystem
' This is just a simple sample on monitor for mouse and keyboard
' activity. This is probably not the best or most efficient algorithm
' to implement.
While waitloop
currenttime = Now()
' get time of last activity
difftime = currenttime - starttime
Label1.Caption = Hour(difftime) & " hrs " & Minute(difftime) & " mins " _
& Second(difftime) & " secs"
' in reality you would do a more comprehensive check
If Minute(difftime) > 1 Then ' if 2 minutes or more went by
' without activity
' Attempt to wake user up, or you can have this program send an
' email
' message to whom it may concern :-).
Beep
starttime = Now() ' reset for next period, or do something else
End If
DoEvents
Wend
End Sub
Private Sub Form_Load()
waitloop = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
WinHook1.HookEnabled = False
WinHook2.KeyboardHook = shkKbdDisabled
waitloop = False
End Sub
' This hook monitors the entire system for mouse activity. It does this by
' detecting all the possible mouse messages such as movements and clicks.
' Refer to this control's messages for a list of messages it is detecting.
Private Sub WinHook1_MouseProc(wnd As Long, msg As Long, X As Long, Y As Long, _
hitcode As Long, peek As Integer, nodef As Integer)
starttime = Now()
End Sub
' This hook monitors the entire system for keyboard activity. It does this by
' detecting all keys. By leaving the "Keys" property blank, it automatically
' selects all keys.
Private Sub WinHook2_KeyDownHook(keycode As Long, ByVal shiftstate As Integer, _
Repetitions As Integer, keystate As Integer, ByVal ProcessID As Long, discard _
As Integer)
starttime = Now()
End Sub |  |
 | Sie sind nicht angemeldet! Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.
Einloggen | Neu registrieren |
  |
|
sevAniGif (VB/VBA) 
Anzeigen von animierten GIF-Dateien
Ab sofort lassen sich auch unter VB6 und VBA (Access ab Version 2000) animierte GIF-Grafiken anzeigen und abspielen, die entweder lokal auf dem System oder auf einem Webserver gespeichert sind. Weitere InfosTipp des Monats Oktober 2025 Matthias KozlowskiUmlaute konvertierenErsetzt die Umlaute in einer Zeichenkette durch die entsprechenden Doppelbuchstaben (aus ä wird ae, usw.) Access-Tools Vol.1 
Über 400 MByte Inhalt
Mehr als 250 Access-Beispiele, 25 Add-Ins und ActiveX-Komponenten, 16 VB-Projekt inkl. Source, mehr als 320 Tipps & Tricks für Access und VB
Nur 24,95 EURWeitere Infos
|
|
|
Copyright ©2000-2025 vb@rchiv Dieter Otter Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.
Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel
|
|