06-11-17, 06:21 PM
(آخر تعديل لهذه المشاركة : 06-11-17, 06:24 PM {2} بواسطة mohammedvego.)
(06-11-17, 03:44 PM)سعود الشامان كتب : اضافة الى ما ذكره اخوي silverlight
https://youtu.be/2K4mrj5aI4c
والله هذا الشرح الي بدي ياه يسلمو بارك الله فيك
(06-11-17, 12:07 PM)silverlight كتب : ما أتوقعه هو انك تقوم باستدعاء Process معينة و تقوم بتشغيلها
أتمني يكون توقعاتي صحيحة
في تلك الحالة يجب أن تتعامل مع الكلاس ProcessStartInfo
PHP كود :
Dim pi As ProcessStartInfo = New ProcessStartInfo
ولإخفاء نافذة الأوامر
يكفي أن تكتب الكود كالتالي
مثال بسيط علي كيفية التعامل مع Command Line WindowPHP كود :
pi.CreateNoWindow = True
المثال يوضح كيفية تمرير أوامر CMD و القراءة من Command Line لكي تحصل علي نتائج معينة
PHP كود :
Private Function GetDetailsCore(currentProcess As Process, func As Func(Of Process, String)) As String
Return func(currentProcess)
End Function
Friend Function GetHardDriveModelNumber() As String
Return GetDetailsCore(New Process, Function(current As Process)
Using current
Dim result As String = CType(Nothing, String)
Dim pi As ProcessStartInfo = New ProcessStartInfo
pi.Arguments = "/c wmic diskdrive get Model"
pi.FileName = "cmd"
pi.RedirectStandardOutput = True
pi.UseShellExecute = False
pi.CreateNoWindow = True
current.StartInfo = pi
current.Start()
Using reader As StreamReader = current.StandardOutput
result = CStr(reader.ReadToEnd())
End Using
' check if string contains white space, if true remove wite spaces
If result.Contains(" ") Then
result = result.Replace(" ", "")
End If
'check if string contains dots, if true remove dots
If result.Contains(".") Then
result = result.Remove(".", "")
End If
' check if string contains dashes, if true remove wite dashes
If result.Contains("-") Then
result = result.Replace("-", "")
End If
' check if string contains the word model, if true remove word model
If result.Contains("Model") Then
result = result.Replace("Model", "")
End If
Return result
End Using
Return Nothing
End Function)
End Function
Friend Function GetMemorychipSerialNumber() As String
Return GetDetailsCore(New Process, Function(current As Process)
Using current
Dim result As String = CType(Nothing, String)
Dim pi As ProcessStartInfo = New ProcessStartInfo
pi.Arguments = "/c wmic memorychip get SerialNumber"
pi.FileName = "cmd"
pi.RedirectStandardOutput = True
pi.UseShellExecute = False
pi.CreateNoWindow = True
current.StartInfo = pi
current.Start()
Dim reader As StreamReader = current.StandardOutput
result = CStr(reader.ReadToEnd())
' check if string contains white space, if true remove wite spaces
If result.Contains(" ") Then
result = result.Replace(" ", "")
End If
'check if string contains dots, if true remove dots
If result.Contains(".") Then
result = result.Remove(".", "")
End If
' check if string contains dashes, if true remove wite dashes
If result.Contains("-") Then
result = result.Replace("-", "")
End If
' check if string contains the word model, if true remove word model
If result.Contains("SerialNumber") Then
result = result.Replace("SerialNumber", "")
End If
Return result
End Using
Return Nothing
End Function)
End Function
دخلتني في دوامه يا اخي مش ادر اطلع منها
المهم بارك الله فيك وشكرااا على المشاركة
القيت الحل من الاخ سعود الشامان
لا تحزن إذا جاءك سهم قاتل من أقرب الناس إلى قلبك