Jump to content
Welcome, Guest
Existing user? Sign In

Sign In



Sign Up
The MatriX
  • Welcome To Ghbsys
  • CS GO Streaming Version is released. Have fun streaming while cheating!
  • Have a Payment Issue? Send us a Support ticket.
  • Make a thread if you need support or join our discord for live support.
  • Have Suggestions? Make a thread and you'll earn Ghbsys Points for implemented suggestions.
  • Join our discord to stay well connected! Don't forget to integrate your discord to the site
  • Welcome to [GHB] - GAmEhAcKbAsTaRdS Forum

    Welcome to [GHB] - GAmEhAcKbAsTaRdS Forum, like most online communities you must register to view or post in our community, but don't worry this is a simple free process that requires minimal information for you to signup. Be apart of [GHB] - GAmEhAcKbAsTaRdS Forum by signing in or creating an account.
    • Start new topics and reply to others
    • Subscribe to topics and forums to get email updates
    • Get your own profile page and make new friends
    • Send personal messages to other members.

    [TuT] Tasten Systemweit sperren


    Dean
     Share

    Recommended Posts

    Den folgenden Code habe ich just for fun programmiert, getestet habe ich Ihn allerdings nicht. Ich hoffe er funktioniert, falls nicht, bitte melden.

    Ich hoffe ich kann euch helfen

     

    Imports System.Runtime.InteropServices
    
    Public Class Form1
    
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       	'Hooks einschalten
       	KeyHookEnable = True
    End Sub
    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
       	'Hooks ausschalten
       	KeyHookEnable = False
    End Sub
    
    'Deklaration von API´s, Variablen und Konstanten
    Private Declare Unicode Function SetWindowsHookExW Lib "user32.dll" (ByVal idHook As Integer, ByVal lpfn As HOOKPROCDelegate, ByVal hMod As IntPtr, ByVal dwThreadId As UInteger) As IntPtr
    Private Declare Unicode Function CallNextHookEx Lib "user32.dll" (ByVal hhk As IntPtr, ByVal nCode As Integer, ByVal wParam As IntPtr, ByRef lParam As KBDLLHOOKSTRUCT) As IntPtr
    Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)
    Private Delegate Function HOOKPROCDelegate(ByVal nCode As Integer, ByVal wParam As IntPtr, ByRef lParam As KBDLLHOOKSTRUCT) As IntPtr
    Private Declare Unicode Function GetModuleHandleW Lib "kernel32.dll" (ByVal lpModuleName As IntPtr) As IntPtr
    Private Declare Unicode Function UnhookWindowsHookEx Lib "user32.dll" (ByVal hhk As IntPtr) As UInteger
    Private HookProc As New HOOKPROCDelegate(AddressOf KeyboardHookProc)
    Private Const WH_KEYBOARD_LL As Integer = 13
    Private Const WM_KEYDOWN As Int32 = &H100
    Private Const WM_KEYUP As Int32 = &H101
    Private Const HC_ACTION As Integer = 0
    Private Const KEYEVENTF_KEYUP = &H2
    Private PrevWndProc As Integer
    Private mHandle As IntPtr
    
    <StructLayout(LayoutKind.Sequential)> Public Structure KBDLLHOOKSTRUCT
       	Public vkCode As Keys
       	Public scanCode, flags, time, dwExtraInfo As UInteger
    
       	Public Sub New(ByVal key As Keys, ByVal scancod As UInteger, ByVal flagss As UInteger, ByVal zeit As UInteger, ByVal extra As UInteger)
           	vkCode = key
           	scanCode = scancod
           	flags = flagss
           	time = zeit
           	dwExtraInfo = extra
       	End Sub
    End Structure
    
    'Hook Ein/Ausschalten
    Private Property KeyHookEnable() As Boolean
       	Get
           	Return mHandle <> IntPtr.Zero
       	End Get
       	Set(ByVal value As Boolean)
           	If KeyHookEnable = value Then Return
           	If value Then
               	mHandle = SetWindowsHookExW(WH_KEYBOARD_LL, HookProc, _
                 	GetModuleHandleW(IntPtr.Zero), 0)
           	Else
               	UnhookWindowsHookEx(mHandle)
               	mHandle = IntPtr.Zero
           	End If
       	End Set
    End Property
    
    Private Function KeyboardHookProc(ByVal nCode As Integer, ByVal wParam As IntPtr, ByRef lParam As KBDLLHOOKSTRUCT) As IntPtr
       	Dim fEatKeyStroke As Boolean
       	If nCode = HC_ACTION Then
           	Select Case lParam.vkCode
               	'Hier wird die Taste vor dem Betriebssystem abgefangen und "runtergeschluckt"
               	'Alt Taste wird abgefangen...
               	Case Keys.Alt
                   	'...und in den Müll geschmissen 
                   	fEatKeyStroke = True
               	Case Keys.LWin
                   	fEatKeyStroke = True
               	Case Keys.RWin
                   	fEatKeyStroke = True
           	End Select
           	If fEatKeyStroke Then
               	Return New IntPtr(1)
               	Exit Function
           	End If
           	Return CallNextHookEx(mHandle, nCode, wParam, lParam)
       	End If
    End Function
    
    End Class

     

    Ich hoffe ich konnte helfen,

    DeanRelease

    Edited by Dean
    • Downvote 1
    Link to comment
    Share on other sites

    • 4 weeks later...

    Hab ich aber schonmal wo anders gesehen mit den gleichen Variablen, mit der gleichen Struktur und Reihenfolge - sicher das das von dir ist?

    Link to comment
    Share on other sites

    Guest
    This topic is now closed to further replies.
     Share

    • Recently Browsing   0 members

      • No registered users viewing this page.
    ×
    ×
    • Create New...