This program actually consist of two parts. i.e
1) Visual Basic Part
2) and a batch file
Visual Basic Part:
Create form as show in the figure.
CODE:
Private Sub Command1_Click()
If Option1.Value = True Then
Shell (“c:\man.bat 4″)
ElseIf Option2.Value = True Then
Shell (“c:\man.bat 3″)
End If
End Sub
Batch Program:
Create a text file and rename to man.bat and place it in C drive
the file will contain the following code:
@echo off
echo Windows Registry Editor Version 5.00 >> c:\man.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsbStor] >> c:\man.reg
echo “start”=dword:00000%1 >>c:\man.reg
regedit.exe /s c:\man.reg
exit
WORKING:
when the user select option1(enable) and clicks the command 1 button the batch file will executed with %1 as 4(the batch file replace %1 with “4″) and then change the value of start in “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsbStor” to “4”
the same when we select disable option.
Thursday, July 8, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment