· Devuelve el título de la ventana de un proceso
· Devuelve el handle de un proceso
· Devuelve el PID de un proceso
Código (vbnet) [Seleccionar]
#Region " Get Process Window Title Function "
' [ Get Process Window Title Function ]
'
' // By Elektro H@cker
'
' Examples :
' MsgBox(Get_Process_Window_Title("cmd"))
' MsgBox(Get_Process_Window_Title("cmd.exe"))
Private Function Get_Process_Window_Title(ByVal ProcessName As String) As String
If ProcessName.ToLower.EndsWith(".exe") Then ProcessName = ProcessName.Substring(0, ProcessName.Length - 4)
Dim ProcessArray = Process.GetProcessesByName(ProcessName)
If ProcessArray.Length = 0 Then Return Nothing Else Return ProcessArray(0).MainWindowTitle
End Function
#End Region
· Devuelve el handle de un proceso
Código (vbnet) [Seleccionar]
#Region " Get Process Handle Function "
' [ Get Process Handle Function ]
'
' // By Elektro H@cker
'
' Examples :
' MsgBox(Get_Process_Handle("cmd"))
' MsgBox(Get_Process_Handle("cmd.exe"))
Private Function Get_Process_Handle(ByVal ProcessName As String) As IntPtr
If ProcessName.ToLower.EndsWith(".exe") Then ProcessName = ProcessName.Substring(0, ProcessName.Length - 4)
Dim ProcessArray = Process.GetProcessesByName(ProcessName)
If ProcessArray.Length = 0 Then Return Nothing Else Return ProcessArray(0).MainWindowHandle
End Function
#End Region
· Devuelve el PID de un proceso
Código (vbnet) [Seleccionar]
#Region " Get Process PID Function "
' [ Get Process PID Function ]
'
' // By Elektro H@cker
'
' Examples :
' MsgBox(Get_Process_PID("cmd"))
' MsgBox(Get_Process_PID("cmd.exe"))
Private Function Get_Process_PID(ByVal ProcessName As String) As IntPtr
If ProcessName.ToLower.EndsWith(".exe") Then ProcessName = ProcessName.Substring(0, ProcessName.Length - 4)
Dim ProcessArray = Process.GetProcessesByName(ProcessName)
If ProcessArray.Length = 0 Then Return Nothing Else Return ProcessArray(0).Id
End Function
#End Region