03-07-24, 11:15 AM
(01-07-24, 04:33 PM)Taha Okla شكرا جزيلا لك الكود يعمل بنجاح ولكنه يقوم باعادة تشغيل ال file explore انا اريد اعادة تشغيل ال windows explorer ارجو المساعدة ولك الشكر الجزيل كتب : وعليكم السلام ورحمة الله وبركاته
أنشئ موديل جديد وضع في الكود التالي :
كود :
Imports System.Diagnostics
Imports System.Runtime.InteropServices
Module Module1
<DllImport("user32.dll", SetLastError:=True)>
Private Function PostMessage(ByVal hWnd As IntPtr, ByVal Msg As UInteger, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Boolean
End Function
<DllImport("user32.dll", SetLastError:=True)>
Private Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
End Function
Const WM_USER As Integer = &H400
Public Sub RestatrtWinExp()
Try
Dim ptr = FindWindow("Shell_TrayWnd", Nothing)
PostMessage(ptr, WM_USER + 436, CType(0, IntPtr), CType(0, IntPtr))
Do
ptr = FindWindow("Shell_TrayWnd", Nothing)
If ptr.ToInt32() = 0 Then
Exit Do
End If
Loop While True
Catch ex As Exception
End Try
Dim explorer As String = String.Format("{0}\{1}", Environment.GetEnvironmentVariable("WINDIR"), "explorer.exe")
Dim process As Process = New Process()
process.StartInfo.FileName = explorer
process.StartInfo.UseShellExecute = True
process.Start()
End Sub
End Module
التنفيذ : يكون بإستدعاء الأمر :
كود :
RestatrtWinExp()
