0

hi all,
i new for vb.net. i try to disable windows key function using vb.net. But by code only work on mouse click.
so i need help to edit my code.
This my code.
Thanks,

Option Strict On
Imports System.Runtime.InteropServices
Public Class Form1
    <DllImport("user32.dll")>
    Private Shared Function FindWindow(className As String, windowText As String) As Integer
    End Function
    <DllImport("user32.dll")>
    Private Shared Function EnableWindow(ByVal hWnd As IntPtr, ByVal bEnable As Boolean) As Boolean
    End Function
    Dim StartButtonhWnd As Integer = 0
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        EnableWindow(CType(StartButtonhWnd, IntPtr), True)
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        StartButtonhWnd = FindWindow("Button", "Start")
        EnableWindow(CType(StartButtonhWnd, IntPtr), False)
    End Sub
End Class
2
Contributors
2
Replies
13
Views
2 Years
Discussion Span
Last Post by ddanbe
1

Hi Rammanan, welcome at daniweb.
You got to intercept one of the key events( KeyPress, KeyDown or KeyUp )instead of the Click event. Example.

1

Hi Rammanan, welcome at daniweb.
You got to intercept one of the key events( KeyPress, KeyDown or KeyUp )instead of the Click event. Example.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.