Toetsenbord en muis vergendelen

  • Onderwerp starter Onderwerp starter Spy1
  • Startdatum Startdatum
Status
Niet open voor verdere reacties.

Spy1

Gebruiker
Lid geworden
2 jul 2007
Berichten
227
Hallo.

Heeft iemand een goeie oplossing voor om de muis en toetsenbord te vergrendelen, zodat er eigenlijk niks kan worden gedaan met de computer? En dan ook een code om de muis en toetsenbord te weer laten werken?

Bedankt =)
 
Hoi,

Punt is: hoe wil je die code invoeren als toetsenbord en muis vergrendeld zijn ....... :cool:
 
Nou, maar sorry. Het is toch wel een beetje voor de hand liggend dat ik bedoel om de muis en toetsenbord van de gebruiker die de programma gebruikt even wil vergrendelen?
 
Nog iets duidelijker.

Je zult toch een 'handeling' moeten verrichten om de vergrendeling weer ongedaan te maken.
Dat kan dus niet met toetsenbord of muis, want die zijn nu juist vergrendeld.......
 
Héél, maar ook héél misschien word dat automatisch gedaan in het programma/code?
 
Om het toetsenbord te ont/ver-grendelen
heb ik de volgende code gevonden op het internet(Google!!!)
Zelf even uitzoeken hoe die precies werkt!

Code:
' must have this in order to use the SendKeys function 
Imports System.Windows.Forms

Public Class WinControl

   ' This is the function used in order to block the keyboard and mouse: 
    Declare Function BlockInput Lib "User32" _ 
           (ByVal fBlockIt As Boolean) As Boolean 
    ' This function will block the keyboard and mouse untill a window with 
    ' the specify caption will appear or the given time in seconds has 
    ' past ( 0 seconds - wait forever). 
    ' If the window with the caption appears than the given key is send 
    ' to it and the input block is removed. 
    Public Shared Function Wait2Send(ByVal caption As String, _ 
              ByVal keys As String, ByVal seconds As Integer)

    ' Indicates if the window with the given caption was found 
        Dim success As Boolean = False

    ' Start time of the function 
        Dim now As DateTime = DateTime.Now

    ' Begining of keyboard and mouse block 
        BlockInput(True)

        While (success = False And (DateTime.Now.Subtract(now).Seconds _ 
                                               < seconds Or seconds = 0)) 
            Try 
                ' Activating the window with desired function 
                ' if the window is not found an exception is thrown. 
                AppActivate(caption)

                ' Sending desired key stroke to the application window 
                SendKeys.SendWait(keys)

                ' Indicates the window was found and keys sent 
                success = True

            Catch 
                ' Assuming window was not found and sleep for 100 miliseconds 
                System.Threading.Thread.Sleep(100) 
            End Try 
        End While 
    ' Release the keyboard block 
        BlockInput(False)

    End Function

End Class
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan