03-08-13, 01:20 PM
03-08-13, 01:25 PM
ببساطة
تشغيل
ايقاف
تذكر يجب عليك تشغيل البرنامج كمسؤول لأن ايقاف الخدمة وتشغيلها يتطلب ذلك
تشغيل
PHP كود :
Shell("net start W3SVC")
PHP كود :
Shell("net stop W3SVC")
تذكر يجب عليك تشغيل البرنامج كمسؤول لأن ايقاف الخدمة وتشغيلها يتطلب ذلك
03-08-13, 01:33 PM
كود تعطيل أو تفعيل الخدمة :
الخدمة tlntsvr وضعتها كمثال ضع بدلها اسم الخدمة تبعك
****
***
**
*
كود :
Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ServiceRunType("tlntsvr", False)
End Sub
Public Sub ServiceRunType(ByVal SrvName As String, ByVal SrvEnable As Boolean)
Try
Dim si As New ProcessStartInfo
Dim command As String = ""
With si
.FileName = "cmd.exe"
If SrvEnable = True Then
command = String.Format("/k sc config {0} start= auto", SrvName)
Else
command = String.Format("/k sc config {0} start= disabled", SrvName)
End If
.Arguments = command
.CreateNoWindow = True
.RedirectStandardError = True
.RedirectStandardOutput = True
.UseShellExecute = False
End With
Dim p As Process = Process.Start(si)
Dim so As StreamReader = p.StandardOutput
Dim se As StreamReader = p.StandardError
Dim StrContent As String = so.ReadToEnd
If StrContent.ToLower.Contains("success") Then
If SrvEnable = True Then
MsgBox("تم تفعيل الخدمة بنجاح", MsgBoxStyle.Exclamation, "تفعيل")
Else
MsgBox("تم تعطيل الخدمة بنجاح", MsgBoxStyle.Exclamation, "تعطيل")
End If
ElseIf StrContent.ToLower.Contains("field") Then
MsgBox("حدث خطأ . لا يمكن تفعيل أو تعطيل الخدمة حاول مرة أخرى", MsgBoxStyle.Exclamation, "خطأ")
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error")
End Try
End Sub
End Classالخدمة tlntsvr وضعتها كمثال ضع بدلها اسم الخدمة تبعك
****
***
**
*
03-08-13, 01:43 PM
بارك الله فيك اخي
