PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : [VB.NET] Tastatur & Maus De/Aktivieren



z0ND
14.07.2009, 21:13
Mit diesem Code lässt sich die Tastatur und die Maus aktivieren bzw. deaktivieren.
Zur Sicherheit sollte man zum Wiederaktivieren einen Timer einbauen, da man sonst nur mit Neustart wieder schreiben und Maus bewegen könnte :D




Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long

Const API_FALSE As Long = 0&
Const API_TRUE As Long = 1&





'Tastatur und Maus deaktivieren
Call BlockInput(API_TRUE)

'Tastatur und Maus aktivieren
Call BlockInput(API_FALSE)



z0ND :cool:

inmate
14.07.2009, 21:32
Nice thanks for share ;)



Public Class Form1
Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long
Const API_FALSE As Long = 0&
Const API_TRUE As Long = 1&

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Call BlockInput(API_TRUE)
Timer1.Start()
Timer1.Interval = 10000

End Sub

Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick

Call BlockInput(API_FALSE)
Timer1.Stop()
Me.Close()
End Sub
End Class


hier nochmal mit timer angepasst ;)

einfach ne timer einfügen.

sarex
14.07.2009, 21:37
super n1
danke
mfg

z0ND
14.07.2009, 21:39
Nice thanks for share ;)



Public Class Form1
Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long
Const API_FALSE As Long = 0&
Const API_TRUE As Long = 1&

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Call BlockInput(API_TRUE)
Timer1.Start()
Timer1.Interval = 10000

End Sub

Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick

Call BlockInput(API_FALSE)
Timer1.Stop()
Me.Close()
End Sub
End Class
hier nochmal mit timer angepasst ;)

einfach ne timer einfügen.

Ich war zu faul dafür^^

phil333
14.07.2009, 21:56
Danke fürs reinstellen^^
Sowas brauche ich sogar gerade ;-)

biggermanbomber
14.07.2009, 22:00
genau ... aber nicht vergessen dem vic nicht die exe mit dem timer zu geben xD sollte man zummindestens nicht machen
*pfeif*

PixXxaS
15.03.2010, 21:00
Also bei mir geht das nich! hab zu 100% alles richtig gemacht!
hab win7 64bit einer ne idee?