adhere


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.net]New Usefull Source Code
Author Message
MaS†erM|nd Offline
† דּ|Ĉ00ךּҒЂď00їŕÈ †
*****

VIP Status
Posts: 874
Joined: Aug 2011
Reputation: 11
Given 3 thank(s) in 3 post(s)
Post: #1
Thumbs Up [VB.net]New Usefull Source Code
Swap Mouse Button

1.Button - Fix it
2.Button - Swap


Code:
Public Class Form1
    Private Declare Function SwapMouseButton Lib "user32" Alias "SwapMouseButton" (ByVal bSwap As Long) As Long
    Private Const MB_DEFBUTTON1 As Long = &H0&
    Private Const MB_DEFBUTTON2 As Long = &H100&
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        SwapMouseButton(MB_DEFBUTTON1)
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        SwapMouseButton(MB_DEFBUTTON2)
    End Sub
End Class


Caps Lock

1.Button - Turn ON Caps Lock
2.Button - Turn OFF Caps Lock


Code:
Imports System.Runtime.InteropServices
Public Class Form1
    <DllImport("user32.dll", CallingConvention:=CallingConvention.StdCall, _
      CharSet:=CharSet.Unicode, EntryPoint:="keybd_event", _
      ExactSpelling:=True, SetLastError:=True)> _
  Private Shared Function keybd_event(ByVal bVk As Int32, ByVal bScan As Int32, _
               ByVal dwFlags As Int32, ByVal dwExtraInfo As Int32) As Boolean
    End Function
    <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Unicode)> _
    Private Shared Function GetKeyState(ByVal nVirtKey As Integer) As Short
    End Function
    Sub SetCapsLockKey(ByVal newState As Boolean)
        If CBool(GetKeyState(Keys.CapsLock)) <> newState Then
            keybd_event(Keys.CapsLock, 0, 0, 0)
            keybd_event(Keys.CapsLock, 0, &H2, 0)
        End If
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        SetCapsLockKey(True)
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        SetCapsLockKey(False)
    End Sub
End Class


Crazy Mouse

1.Timer
2.Button - Start

Code:
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Timer1.Start()
    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim random As New Random
        System.Windows.Forms.Cursor.Position = New System.Drawing.Point(random.Next(0, 1000), random.Next(0, 1200))
    End Sub
End Class

Disable Mouse/Keyboard

1.Button - Disable
2.Button - Enable


Code:
Public Declare Function apiBlockInput Lib "user32" Alias "BlockInput" (ByVal fBlock As Integer) As Integer
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        apiBlockInput(0)
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        apiBlockInput(1)
    End Sub


USB Write

1.Button - Block
2.Button - Unblock

Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        My.Computer.Registry.SetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies", "WriteProtect", "00000001", Microsoft.Win32.RegistryValueKind.DWord)
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        My.Computer.Registry.SetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies", "WriteProtect", "00000000", Microsoft.Win32.RegistryValueKind.DWord)
    End Sub


Credit to 007HackerBoy

[Image: gzxYF.png]
08-09-2011 04:24 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Advertisement
envyus
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)
Navigation
adhere
Sponsors
afil
Alexa Rank