borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Rotated Text)Next Topic (Remarks?) New Topic New Poll Post Reply
AndreaVB Forum : VB General : Disable Window Key
Poster Message
noycez
Level: VB Guru


Registered: 14-10-2002
Posts: 79

icon Disable Window Key

here is another one, how can i disable the window's key in VB?? tnx for the help guys       

____________________________
Funny thought:

Practice makes perfect.....
But nobody's perfect......
so why practice?

11-03-2003 at 02:27 AM
View Profile Send Email to User Show All Posts | Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1617
icon Re: Disable Window Key

Win9x tell the OS that a screensaver's running (code exists elsewhere on the board).

NT->I believe requires some system editing (registry changes), unless your trying to create a program to completely lock down a system (like for a demo PC in a store), it's not easy. As a note, even games that have a disable windows key, it doesn't always work, and it's coded in C.

____________________________
Everywhere's Local (classifieds, job postings, & more for everycity in the world - user entered)

11-03-2003 at 09:51 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
vbgen
Level: Moderator

Registered: 10-10-2002
Posts: 876
icon Re: Disable Window Key

hello, noycez...

again, to clear things up, i created my signature below..

i've tried this on win98, and it works like a charm....

when you load your program and do the ctrl+alt+del thing...
(if you've found an alternative for win2k already)

use the two subs on load and unload...
load: hidetaskbar
unload: showtaskbar


i would suggest that if you intend to do the maximization of the form's size, try to start first with making the taskbar autohide, so your screen won't look a bit disturbing...

you'll see what i mean when you try without the autohide.

here's the code...


Option Explicit
'for hiding and showing the taskbar
Private TaskBarhWnd As Long

Private Const SWP_SHOWWINDOW = &H40
Private Const SWP_HIDEWINDOW = &H80

Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, _
    ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, _
    ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
    
Private Declare Function FindWindow Lib "user32" _
   Alias "FindWindowA" (ByVal lpClassName As String, ByVal _
   lpWindowName As String) As Long

'------------------------------------------------------
'hide the taskbar to secure the pc from unauthorized access
Public Sub HideTaskBar()
    TaskBarhWnd = FindWindow("Shell_traywnd", "")
    If TaskBarhWnd <> 0 Then
       Call SetWindowPos(TaskBarhWnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW)
    End If
End Sub
'------------------------------------------------------
'shows the taskbar when accessible due to user level
Public Sub ShowTaskBar()
    If TaskBarhWnd <> 0 Then
       Call SetWindowPos(TaskBarhWnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW)
    End If
End Sub


again, i hope this'll help you with your win2k



____________________________
Been busy trying to take a second degree <--it's not working out...

14-03-2003 at 04:45 PM
View Profile Send Email to User Show All Posts | Quote Reply
win_dir
Level: VB Guru

Registered: 04-08-2002
Posts: 390
icon Re: Disable Window Key

Just thought i'd say that if this guy really wants to stop the "windows key" from working then autohiding the taskbar is absolutely useless , or it is in XP, becasue the start menu still comes up when you press the key on the the taskbar.

____________________________
We have a Mustek 5 M/Pix GSm@rt USB Digital Camera
for just £74.03 , offer only on until 30th February!

<AllDuck.com>      

Enquiries/Sales: 0845 430 9862
Fax: 0870 950 4532

19-03-2003 at 09:59 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
greyshirtguy
Level: Guest

icon Re: Disable Window Key

I found an example of blocking ALT-TAB and other keys at www.vbguru.com and modified it to work with the Windows Keys... It works OK on my XP box

** Credit goes to Ovidiu Crisan - http://vbwork.4mg.com **

Download an example project with instructions (howto.txt) from My Example VB Project

[Edited by greyshirtguy on 21-04-2003 at 11:30 AM GMT]

21-04-2003 at 01:15 AM
| Quote Reply
mizmerize
Level: Guest

icon Re: Disable Window Key

Gee!! Thanks... It really worked!
Backgrounder: My friend plucked out his keyboards' windows keys in order to prevent his clients from activating the start menu.


...this only worked for NT. It does not work on Win95-98.

[Edited by mizmerize on 24-04-2003 at 06:52 AM GMT]

24-04-2003 at 06:43 AM
| Quote Reply
win_dir
Level: VB Guru

Registered: 04-08-2002
Posts: 390
icon Re: Disable Window Key

XP and win 2000 are both NT-based. I have just sent an email to another site because all of thier code samples were down and i should soon have the code to hide the taskbar.

____________________________
We have a Mustek 5 M/Pix GSm@rt USB Digital Camera
for just £74.03 , offer only on until 30th February!

<AllDuck.com>      

Enquiries/Sales: 0845 430 9862
Fax: 0870 950 4532

27-04-2003 at 12:06 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : VB General : Disable Window Key
Previous Topic (Rotated Text)Next Topic (Remarks?) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder