how to disable and enable windows keys using vb6 coding? plz help me..................

Recommended Answers

All 16 Replies

You can't handle windows keys.

You can't handle windows keys.

is there any way to stop working of the combination keys of win+r, win+e etc and also to lock the start menu after it has appeared in the desktop when the win key is pressed?

As i mentioned you can't handle the windows key but can call some of the API to handle some of windows + key combinations.

As i mentioned you can't handle the windows key but can call some of the API to handle some of windows + key combinations.

can you tell me how to lock the start menu while it appears in the desktop when the windows key is pressed?

That's what i am trying to explain to you. you can't handle the windows key in VB. But can still handle some of windows + key combination through API calls.

That's what i am trying to explain to you. you can't handle the windows key in VB. But can still handle some of windows + key combination through API calls.

thank you..........

as debasisdas said you cannot handle the win key.
you can disable windows key using api for mouse clicking only and u still can access start button with press it,,
this following code for disable win key from mouse clicking.

Option Explicit
'
Dim TFlag As Boolean
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

'
Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, _
ByVal fEnable As Long) As Long
 
Public Sub EnableStartMenuButton(ByVal bEnable As Boolean)
   Dim lHwnd As Long
   '
   lHwnd = FindWindowEx(0&, 0&, "Shell_TrayWnd", vbNullString)
   lHwnd = FindWindowEx(lHwnd, 0&, "Button", vbNullString)
   Call EnableWindow(lHwnd, bEnable)
   '
End Sub

' disable win key
Private Sub Command1_Click()
    TFlag = Not TFlag
    EnableStartMenuButton (TFlag)
End Sub

' Enable win key
Private Sub Command2_Click()
    TFlag = True
    EnableStartMenuButton (TFlag)
End Sub

Private Sub Form_Load()
    TFlag = True
    Command1.Caption = "Disable"
    Command2.Caption = "Enable"
End Sub

sorry but yes u can handle any key command on windows if it can be pressed by keyboard for example alt + ctrl + del, alt + tab, ctrl + shift, ctrl + exc,
if this was ur question
other else try to be specific pls

and if u r searching how to disable Start Menu on windows yes it can also be done by coding mod bas and add it to ur project

help me, explain briefly to lock the windows in order to function

what i understood from u is that u want to make a program that locks all the computer right as if it is a screen saver u cant do anything till u add a password is that right?

thank you for your attention. where I input the code it where? only in regular form?

do u know how to create a bas file to add to project or no

@pito_donje, Do Not Hijack other thread..make your own thread..

Pito has opened his own thread after that JX, thanks.:)

andre, i already post on it too :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.