eso obtiene los comandos...para hacer funcionarlo tenes que pasarle el PID del proceso que queres saber...para eso hay api's busca que hay en internet...
saludos.
Bueno gracias .. pero igual no supe utilizarlo.. por ahora
conseguir averiguar el PID del Exe con Este codigo:
En Modulo:
Option Explicit
Public theid As Integer
Public Const NORMAL_PRIORITY_CLASS As Long = &H20
Public Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Public Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessId As Long
dwThreadID As Long
End Type
Public Declare Function CreateProcess Lib "kernel32" Alias _
"CreateProcessA" (ByVal lpAppName As String, _
ByVal lpCommandLine As String, ByVal lpProcessAttributes As Long, _
ByVal lpThreadAttributes As Long, ByVal bInheritHandles As Long, _
ByVal dwCreationFlags As Long, ByVal lpEnvironment As Long, _
ByVal lpCurrentDirectory As String, lpStartupInfo As STARTUPINFO, _
lpProcessInformation As PROCESS_INFORMATION) As Long
' Returns 0 when successful, process ID and handle are in ProcessInfo
Public Function StartProcess(ByRef sCommandLine As String, _
ByRef ProcessInfo As PROCESS_INFORMATION) As Long
Dim ret As Long
Dim sWokingDir As String
Dim Start As STARTUPINFO
If Len(sCommandLine) > 0 Then
' Initialize the STARTUPINFO structure:
Start.cb = Len(Start)
sWokingDir = App.Path
' Start the process
ret = CreateProcess(vbNullString, sCommandLine, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, sWokingDir, Start, ProcessInfo)
If ret <> 0 Then
' Success
StartProcess = 0
Else
' Failed to start process
Debug.Print "StartProcess failed: LastDllError = " & _
Err.LastDllError
StartProcess = 1
End If
End If
End Function
' Close process and thread handles, must be called when no longer needed
Public Sub ReleaseProcessData(ByRef ProcessInfo As PROCESS_INFORMATION)
If ProcessInfo.hProcess <> 0 Then
'CloseHandle ProcessInfo.hThread
'CloseHandle ProcessInfo.hProcess
'ProcessInfo.hProcess = 0
'ProcessInfo.hThread = 0
End If
End Sub
En Form:
Option Explicit
Private Sub Command1_Click()
Dim ProcessInfo As PROCESS_INFORMATION
StartProcess "C:\Archivos de programa\Black Isle\BGII - SoA\baldur.exe", ProcessInfo
Text1.Text = "Process ID: " & ProcessInfo.dwProcessId
Text1.Text = Text1.Text & vbNewLine & "Process handle: " & ProcessInfo.hProcess
ReleaseProcessData ProcessInfo
End Sub
Con eso saco el ID del exe...
Y nose si soy un poco Ignorante o no me doy cuenta,
pero a tu codigo intente de llamarlo asi:
Private Sub Command2_Click()
ProcessCommandLine(theid)
End Sub
Pero nada sucede... Quizas no se le llame asi o quizas si.. pero nose...
Yo en teoria lo que intento de conseguir es por ejemplo:
Ejecutar Baldurs Gate II Shadows Of Amn y que directamente al ejecutar el juego entre a una partida multijugador como ya dije antes estilo (Zone o el Nuevo IGZones)
Si alguien lo conoce seguro que saben a que me refiero(jugar age of empires en internet)
PD: llame a la funcion asi:
MsgBox ProcessCommandLine(theid)
Mmm pero me muestra la direccion del Juego(Dir del Exe)
PD2: Me di cuenta que el archivo Baldur.exe es un launcher y el archivo BGMain.exe es el juego en Si... pero al intentar de ejecutar ese exe me tira el siguiente error:
Quizas haya que ejecutar ese exe con un parametro.. ahora me queda averiguar como averiguarlo hehe.
PD3: Si voy a la carpeta y hago doble click sobre el archivo BGMain.exe.. si se abre...
PD4: Bueno he ejecutado el BGMain.exe normal, he conseguido su PID y he hecho un timer con la siguiente funcion:
List1.AddItem ProcessCommandLine(theid)
la cual funcionaba mientras yo en el juego toqueteaba botones y eso.. pero no muestra nada...
No se como hacer funcionar este codigo
Desde ya, gracias y sepan disculpar mi ignorancia
Salu2
Ranslsad