السلام عليكم ورحمة الله وبركاته
ارجو المساعدة في انهاء اكسبلورر من المهام لويندوز 7 64 بت
حيث ان الكود المخصص لهذه العملية في ويندوز اكس بي هو
Shell "taskkill /F /im explorer.exe", vbHide
Sleep 400
Shell "explorer.exe", vbHide
لكن هذه الطريقة لا تعمل على ويندوز 7 64 بت .. لذلك ارجو المساعدة في اعطائى الكود لهذه العملية وشكراً
Private Declare Function CreateToolhelp32Snapshot Lib "kernel32" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long
Private Declare Function Process32First Lib "kernel32" (ByVal hSnapshot As Long, lppe As PROCESSENTRY32) As Long
Private Declare Function Process32Next Lib "kernel32" (ByVal hSnapshot As Long, lppe As PROCESSENTRY32) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Const TH32CS_SNAPPROCESS As Long = 2&
Private Const MAX_PATH As Integer = 260
Private Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szExeFile As String * MAX_PATH
End Type
Public Function TerminateEXE(ByVal sExeNam As String) As Boolean
Dim lLng As Long, lA As Long, lExCode As Long
Dim procObj As PROCESSENTRY32
Dim hSnap As Long
Dim lRet As Long
hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0&) 'create a snapshot of the system process information
procObj.dwSize = Len(procObj)
lRet = Process32First(hSnap, procObj) 'Query information on the top-most running process
Do While Process32Next(hSnap, procObj) 'loop through all the processes
If InStr(1, LCase(procObj.szExeFile), LCase(sExeNam$)) > 0 Then 'Your exe name has been found
lLng = OpenProcess(&H1, ByVal 0&, procObj.th32ProcessID) 'Open the process as to get its handle
lA = TerminateProcess(lLng, lExCode) 'Terminate the process
TerminateEXE = lA
Exit Do
End If
Loop
End Function
Private Sub Command1_Click()
MsgBox (TerminateEXE("explorer.exe"))
End Sub