|
-
Jan 23rd, 2010, 11:53 PM
#11
Lively Member
Re: Block Exe
 Originally Posted by chunk
hi
is there a way to block an exe? that user can not run the exe 
chunk you can do this in two ways
1) In this way you have to provide only the actual exe name with its extension and not thr path heres the code
Code:
Private Sub Command1_Click()
If List1.ListCount = 0 Then
MsgBox "Add one item"
Else
Dim i As Integer
For i = 0 To List1.ListCount - 1
Shell ("REG ADD HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v DisallowRun /t REG_DWORD /d 00000001 /f")
Shell ("REG ADD HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun /v " & i & " /d " & List1.List(i) & " /f")
Next i
MsgBox i & " items Blocked Please Logoff to see the effects"
End If
End Sub
Private Sub Form_Load()
List1.AddItem "msconfig.exe"
List1.AddItem "iexplorer.exe"
End Sub
2) In this way you have add the applications full or a part of its caption here the code for it
Code:
Private Declare Function GETWINDOWTEXT Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Const WM_CLOSE = &H10
Private Declare Function GetForegroundWindow Lib "user32" () As Long
'Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Sub Form_Load()
List1.AddItem "fire"
List1.AddItem "exp"
List1.AddItem "opera"
End Sub
Private Sub Timer1_Timer()
Dim actH As Long
Dim i As Integer
Dim cap As String * 256
actH = GetForegroundWindow
GETWINDOWTEXT actH, cap, 256
For i = 0 To List1.ListCount - 1
If InStr(1, LCase(cap), LCase(List1.List(i))) <> 0 Then
SendMessage actH, WM_CLOSE, 0, 0
MsgBox "App Blocked By Administrator!!!!", vbOKOnly + vbExclamation, "D&G-RAS-AppBlocker-By Assault"
End If
Next i
End Sub
if you want to block folders also with second method than use PostMessage() instead of SendMessage()
i have created this codes for my college project hope this will help you and othes members too.....
Last edited by agent_007; Jan 24th, 2010 at 12:40 AM.

Im Pro in C#,VB.NET,Batch,Socket Programming, SPY Software Programming, VB6, Win32Api, VBscript, Windows Registry, ASP.NET, PHP, Jquery, AJAX.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|