I can activate taskmgr from a macro by
SHELL("c:\windows\system32\taskmgr.exe")
How can I access the displayed process information, i.e. process name and
PID, or get taskmgr to copy this information to a text file?
--
Gary's Student
I can activate taskmgr from a macro by
SHELL("c:\windows\system32\taskmgr.exe")
How can I access the displayed process information, i.e. process name and
PID, or get taskmgr to copy this information to a text file?
--
Gary's Student
Perhaps someone will prove me wrong, but I think you would need some
sophisticated API trickery to do this.
--
Vasant
"Gary's Student" <[email protected]> wrote in message
news:[email protected]...
> I can activate taskmgr from a macro by
>
> SHELL("c:\windows\system32\taskmgr.exe")
>
> How can I access the displayed process information, i.e. process name and
> PID, or get taskmgr to copy this information to a text file?
> --
> Gary's Student
If you're really ambitious, you can try and adapt this for your needs (I
tested it and it works but you may have to tweak it to get all the
information you want):
How to list running processes
http://support.microsoft.com/default...b;en-us;187913
--
Vasant
"Vasant Nanavati" <vasantn *AT* aol *DOT* com> wrote in message
news:[email protected]...
> Perhaps someone will prove me wrong, but I think you would need some
> sophisticated API trickery to do this.
>
> --
>
> Vasant
>
>
> "Gary's Student" <[email protected]> wrote in message
> news:[email protected]...
> > I can activate taskmgr from a macro by
> >
> > SHELL("c:\windows\system32\taskmgr.exe")
> >
> > How can I access the displayed process information, i.e. process name
and
> > PID, or get taskmgr to copy this information to a text file?
> > --
> > Gary's Student
>
>
Thanks for your help Vasant. I'll give your reference a try. If I can get
to a working API, then this will give me all that I need.
Thanks again
--
Gary's Student
"Vasant Nanavati" wrote:
> If you're really ambitious, you can try and adapt this for your needs (I
> tested it and it works but you may have to tweak it to get all the
> information you want):
>
> How to list running processes
> http://support.microsoft.com/default...b;en-us;187913
>
> --
>
> Vasant
>
> "Vasant Nanavati" <vasantn *AT* aol *DOT* com> wrote in message
> news:[email protected]...
> > Perhaps someone will prove me wrong, but I think you would need some
> > sophisticated API trickery to do this.
> >
> > --
> >
> > Vasant
> >
> >
> > "Gary's Student" <[email protected]> wrote in message
> > news:[email protected]...
> > > I can activate taskmgr from a macro by
> > >
> > > SHELL("c:\windows\system32\taskmgr.exe")
> > >
> > > How can I access the displayed process information, i.e. process name
> and
> > > PID, or get taskmgr to copy this information to a text file?
> > > --
> > > Gary's Student
> >
> >
>
>
>
Well it looks like "trickery" to me...
'------------------------------
'From... Ivan F Moala [email protected]
' public.excel.programming - March 20, 2004
'With some minor changes by
Jim Cone - San Francisco, USA
'----------------------
'WinXp / Xl2003
'// WMI String Constants
Private Const strWmgt As String = "winmgmts:" & _
"{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2"
Private Const strWmiQ As String = "Select * from Win32_Process"
Sub OwnerOfProcesses()
Dim objWMIService As Object
Dim colProcessList As Object
Dim objProcess As Object
Dim strNameOfUser As Variant 'JBC
Dim strUserDomain As Variant 'JBC
Dim colProperties As String
Dim MyList() As Variant 'JBC
Dim x As Long 'JBC
Set objWMIService = GetObject(strWmgt)
Set colProcessList = objWMIService.ExecQuery(strWmiQ)
x = colProcessList.Count
ReDim MyList(0 To (x - 1), 0 To 3) 'JBC
x = 0
For Each objProcess In colProcessList
colProperties = objProcess.GetOwner(strNameOfUser, strUserDomain)
MyList(x, 0) = objProcess.Name
MyList(x, 1) = strUserDomain
MyList(x, 2) = strNameOfUser
MyList(x, 3) = objProcess.Handle
x = x + 1
Next
With Range("A1:D1")
.Value = Array("Process", "Domain", "User", "PID") 'JBC
.Font.Bold = True
End With
Range("A2").Resize(x, 4).Value = MyList 'JBC
Columns("A:D").AutoFit 'JBC
MsgBox "Processes: " & x
Set objWMIService = Nothing 'JBC
Set colProcessList = Nothing 'JBC
Set objProcess = Nothing 'JBC
End Sub
'--------------------------------------------
"Gary's Student" <[email protected]> wrote in
message news:[email protected]...
I can activate taskmgr from a macro by
SHELL("c:\windows\system32\taskmgr.exe")
How can I access the displayed process information, i.e. process name and
PID, or get taskmgr to copy this information to a text file?
Gary's Student
Now that is pretty darned neat ... kudos to Ivan!
--
Vasant
"Jim Cone" <[email protected]> wrote in message
news:%[email protected]...
>
> Well it looks like "trickery" to me...
>
> '------------------------------
> 'From... Ivan F Moala [email protected]
> ' public.excel.programming - March 20, 2004
> 'With some minor changes by
> Jim Cone - San Francisco, USA
> '----------------------
>
> 'WinXp / Xl2003
> '// WMI String Constants
> Private Const strWmgt As String = "winmgmts:" & _
> "{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2"
> Private Const strWmiQ As String = "Select * from Win32_Process"
>
> Sub OwnerOfProcesses()
> Dim objWMIService As Object
> Dim colProcessList As Object
> Dim objProcess As Object
> Dim strNameOfUser As Variant 'JBC
> Dim strUserDomain As Variant 'JBC
> Dim colProperties As String
> Dim MyList() As Variant 'JBC
> Dim x As Long 'JBC
>
> Set objWMIService = GetObject(strWmgt)
> Set colProcessList = objWMIService.ExecQuery(strWmiQ)
>
> x = colProcessList.Count
> ReDim MyList(0 To (x - 1), 0 To 3) 'JBC
> x = 0
>
> For Each objProcess In colProcessList
> colProperties = objProcess.GetOwner(strNameOfUser, strUserDomain)
> MyList(x, 0) = objProcess.Name
> MyList(x, 1) = strUserDomain
> MyList(x, 2) = strNameOfUser
> MyList(x, 3) = objProcess.Handle
> x = x + 1
> Next
>
> With Range("A1:D1")
> .Value = Array("Process", "Domain", "User", "PID") 'JBC
> .Font.Bold = True
> End With
> Range("A2").Resize(x, 4).Value = MyList 'JBC
> Columns("A:D").AutoFit 'JBC
> MsgBox "Processes: " & x
>
> Set objWMIService = Nothing 'JBC
> Set colProcessList = Nothing 'JBC
> Set objProcess = Nothing 'JBC
> End Sub
> '--------------------------------------------
>
>
> "Gary's Student" <[email protected]> wrote in
> message news:[email protected]...
> I can activate taskmgr from a macro by
> SHELL("c:\windows\system32\taskmgr.exe")
> How can I access the displayed process information, i.e. process name and
> PID, or get taskmgr to copy this information to a text file?
> Gary's Student
Thank you both very much !!
--
Gary's Student
"Vasant Nanavati" wrote:
> Now that is pretty darned neat ... kudos to Ivan!
>
> --
>
> Vasant
>
>
> "Jim Cone" <[email protected]> wrote in message
> news:%[email protected]...
> >
> > Well it looks like "trickery" to me...
> >
> > '------------------------------
> > 'From... Ivan F Moala [email protected]
> > ' public.excel.programming - March 20, 2004
> > 'With some minor changes by
> > Jim Cone - San Francisco, USA
> > '----------------------
> >
> > 'WinXp / Xl2003
> > '// WMI String Constants
> > Private Const strWmgt As String = "winmgmts:" & _
> > "{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2"
> > Private Const strWmiQ As String = "Select * from Win32_Process"
> >
> > Sub OwnerOfProcesses()
> > Dim objWMIService As Object
> > Dim colProcessList As Object
> > Dim objProcess As Object
> > Dim strNameOfUser As Variant 'JBC
> > Dim strUserDomain As Variant 'JBC
> > Dim colProperties As String
> > Dim MyList() As Variant 'JBC
> > Dim x As Long 'JBC
> >
> > Set objWMIService = GetObject(strWmgt)
> > Set colProcessList = objWMIService.ExecQuery(strWmiQ)
> >
> > x = colProcessList.Count
> > ReDim MyList(0 To (x - 1), 0 To 3) 'JBC
> > x = 0
> >
> > For Each objProcess In colProcessList
> > colProperties = objProcess.GetOwner(strNameOfUser, strUserDomain)
> > MyList(x, 0) = objProcess.Name
> > MyList(x, 1) = strUserDomain
> > MyList(x, 2) = strNameOfUser
> > MyList(x, 3) = objProcess.Handle
> > x = x + 1
> > Next
> >
> > With Range("A1:D1")
> > .Value = Array("Process", "Domain", "User", "PID") 'JBC
> > .Font.Bold = True
> > End With
> > Range("A2").Resize(x, 4).Value = MyList 'JBC
> > Columns("A:D").AutoFit 'JBC
> > MsgBox "Processes: " & x
> >
> > Set objWMIService = Nothing 'JBC
> > Set colProcessList = Nothing 'JBC
> > Set objProcess = Nothing 'JBC
> > End Sub
> > '--------------------------------------------
> >
> >
> > "Gary's Student" <[email protected]> wrote in
> > message news:[email protected]...
> > I can activate taskmgr from a macro by
> > SHELL("c:\windows\system32\taskmgr.exe")
> > How can I access the displayed process information, i.e. process name and
> > PID, or get taskmgr to copy this information to a text file?
> > Gary's Student
>
>
>
You need Edanmo's task scheduler.
Have a look at this website:
http://www.mvps.org/emorcillo/en/code/vb6/index.shtml
Go to: Using the Task Scheduler
This is a VB dll file that makes all the properties and methods of the task
scheduler available in VBA. I am using this and it works very well.
RBS
"Gary's Student" <[email protected]> wrote in message
news:[email protected]...
>I can activate taskmgr from a macro by
>
> SHELL("c:\windows\system32\taskmgr.exe")
>
> How can I access the displayed process information, i.e. process name and
> PID, or get taskmgr to copy this information to a text file?
> --
> Gary's Student
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks