Stop Accessing Network Neighborhood

jatinderbahl
jatinderbahl used Ask the Experts™
on
hi
  i want to develop software in vb , in which i want the node computer  on network cannot /Stop Accessing Network Neighborhood, hard drive. This is basically for Cyber Cafe Solution. Only Internet Explorer should work


Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
The best way to do this is to set up a policies on your server,but if you want to do this from VB then this should work but it will require a logoff for the changes to take effect:

Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal Hkey As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal Hkey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal Hkey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Private Const HKEY_LOCAL_MACHINE = &H80000002
Private Const ERROR_SUCCESS = 0&
Private Const REG_SZ = 1
Private Const REG_DWORD = 4
Private X As Long

Function SaveDword(ByVal Hkey As Long, ByVal strPath As String, ByVal strValueName As String, ByVal lData As Long)
    Dim lResult As Long
    Dim keyhand As Long
    Dim r As Long
    r = RegCreateKey(Hkey, strPath, keyhand)
    lResult = RegSetValueEx(keyhand, strValueName, 0&, REG_DWORD, lData, 4)
    r = RegCloseKey(keyhand)
End Function


Private Sub Command1_Click()
' remove network neighborhood
Call SaveDword(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoNetHood", 1)
End Sub

Private Sub Command2_Click()
' add network neighborhood back
Call SaveDword(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoNetHood", 0)
End Sub

Author

Commented:
hi vinnyd79

   code work very fine, but how can i stop access the node computer from accessing 'C:' drive and my computer icon and control panel.



Thanks

Commented:
I added more command buttons to demonstrate each registry setting.

Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal Hkey As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal Hkey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal Hkey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Private Const HKEY_LOCAL_MACHINE = &H80000002
Private Const ERROR_SUCCESS = 0&
Private Const REG_SZ = 1
Private Const REG_DWORD = 4
Private X As Long

Function SaveDword(ByVal Hkey As Long, ByVal strPath As String, ByVal strValueName As String, ByVal lData As Long)
   Dim lResult As Long
   Dim keyhand As Long
   Dim r As Long
   r = RegCreateKey(Hkey, strPath, keyhand)
   lResult = RegSetValueEx(keyhand, strValueName, 0&, REG_DWORD, lData, 4)
   r = RegCloseKey(keyhand)
End Function


Private Sub Command1_Click()
' remove network neighborhood
Call SaveDword(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoNetHood", 1)
End Sub

Private Sub Command2_Click()
' add network neighborhood back
Call SaveDword(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoNetHood", 0)
End Sub

Private Sub Command3_Click()
' remove control panel
Call SaveDword(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoSetFolders", 1)
End Sub

Private Sub Command4_Click()
' add control panel back
Call SaveDword(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoSetFolders", 0)
End Sub

Private Sub Command5_Click()
' remove all drives from my computer
Call SaveDword(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoDrives", 67108863)
End Sub

Private Sub Command6_Click()
' add all drives back to my computer
Call SaveDword(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoDrives", 0)
End Sub

Private Sub Command7_Click()
' remove run from Start Menu
Call SaveDword(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoRun", 1)
End Sub

Private Sub Command8_Click()
' add run back to start menu
Call SaveDword(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoRun", 0)
End Sub

Private Sub Command9_Click()
' remove Find Menu from Start Menu
Call SaveDword(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoFind", 1)
End Sub

Private Sub Command10_Click()
' add Find Menu back to start menu
Call SaveDword(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoFind", 0)
End Sub





CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

Author

Commented:
hi


 i tried to   remove all drives from my computer but when i start windows explorer and type "c:" in address bar c: drive start appear how can i stop this.


Private Sub Command5_Click()
' remove all drives from my computer
Call SaveDword(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoDrives", 67108863)
End Sub


Thanxs

Commented:
you could use this to prevent users from browsing files through internet explorer.For windows explorer can you delete the explorer icon from the Programs Menu? Or maybe copy the explorer icon from the programs menu to a directory on c: ,Then you could copy it back if you need it again?


Private Sub Command11_Click()
' disallow file's to be viewed in explorer
Call SaveDword(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoFileUrl", 1)
End Sub

Private Sub Command12_Click()
' allow file's to be viewed in explorer
Call SaveDword(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoFileUrl", 0)
End Sub

Author

Commented:
hi


   it sound to be ok. Thanks for this part. But how can i stop user accesing MY Computer icon.

I think this is the last thing i need.

Thanks
Commented:
Give this a try.It should work on Win2000,ME and XP but Im not sure about NT 4.0 and Win98:

Private Sub Command13_Click()
' hide my computer
Call SaveDword(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Policies\NonEnum", "{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 1)
End Sub

Private Sub Command14_Click()
' show my computer
Call SaveDword(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Policies\NonEnum", "{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 0)
End Sub


This workaround might help for Win98 and NT if the above doesn't work:
http://www.activewin.com/tips/desk_tips_9.shtml

Author

Commented:
hi vinnyd79

   
Private Sub Command11_Click()
' disallow file's to be viewed in explorer
Call SaveDword(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoFileUrl", 1)
End Sub

Private Sub Command12_Click()
' allow file's to be viewed in explorer
Call SaveDword(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoFileUrl", 0)
End Sub

     This code does not make any difference



Commented:
that code is supposed to stop the user from entering a file location such as C:\ into internet explorer address window.
Are you sure it doesn't work? It works on my system.

Author

Commented:
hi


     if i type c:\ in iE it just show back the drive.  all i want user should not access the drives.

Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial