|
-
Oct 8th, 2008, 01:15 PM
#1
[RESOLVED] Retrieve items from TaskManager's listview
I was actually testing a code on my own but it was bombing and I left it at work. Perhaps you guys could pinpoint me to a clearer path. I was using some API and a LV_Item type but it was crashing leaving me clueless. I will try to post the code when I get to work.
-
Oct 8th, 2008, 02:38 PM
#2
Member
Re: Retrieve items from TaskManager's listview
hi,
i use this to see all my processes when my task manager is busted by some
virus.it was originally made in vbscript, but it works in vb6 too.
vb Code:
Private Sub Form_Load() Dim x, y, z, m, g, k, o, b, ws Set ws = CreateObject("wscript.shell") Set x = GetObject("winmgmts:") Set y = x.instancesof("Win32_Process") For Each z In y g = 0 k = z.getownersid m = m & z.Description & " " & g & " " & k & " " & " " & vbCrLf Next MsgBox m, 64, "w32 Processes" End Sub
cheers mate!
-
Oct 8th, 2008, 07:47 PM
#3
Re: Retrieve items from TaskManager's listview
Well, I could easily list the processes but I what I really want is to retrieve the items from the TaskManager's listview for another purpose...
-
Oct 9th, 2008, 12:20 AM
#4
Re: Retrieve items from TaskManager's listview
This is my attempt, it is failing on the boldened line, can anyone pinpoint what I am doing wrong?
Code:
Option Explicit
Private Enum LVITEM_state
LVIS_FOCUSED = &H1
LVIS_SELECTED = &H2
LVIS_CUT = &H4
LVIS_DROPHILITED = &H8
LVIS_ACTIVATING = &H20
LVIS_OVERLAYMASK = &HF00
LVIS_STATEIMAGEMASK = &HF000
End Enum
Private Enum LVITEM_mask
LVIF_TEXT = &H1
LVIF_IMAGE = &H2
LVIF_PARAM = &H4
LVIF_STATE = &H8
#If (WIN32_IE >= &H300) Then
LVIF_INDENT = &H10
LVIF_NORECOMPUTE = &H800
#End If
LVIF_DI_SETITEM = &H1000 ' NMLVDISPINFO notification
End Enum
Private Type LVITEM ' was LV_ITEM
mask As Long
iItem As Long
iSubitem As Long
state As Long
stateMask As Long
pszText As String
cchTextMax As Long
iImage As Long
lParam As Long
iIndent As Long
End Type
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Const LVM_FIRST = &H1000
Private Const LVM_GETITEMCOUNT = (LVM_FIRST + 4)
Private Const LVM_GETITEM = (LVM_FIRST + 5)
Function HexToDec(HexValue As String) As Long
HexToDec = Val("&H" & HexValue)
End Function
Private Sub Command1_Click()
Dim a As Long
Dim b As Long
Dim hWnd As Long
Dim lvi As LVITEM
hWnd = HexToDec("000D03E6")
b = ListView_GetItemCount(hWnd)
b = b - 1
For a = 0 To b
lvi.mask = LVIF_TEXT
lvi.iItem = a
ListView_GetItem hWnd, lvi
Debug.Print lvi.pszText
Next
MsgBox "Done"
End Sub
Public Function ListView_GetItemCount(hWnd As Long) As Long
ListView_GetItemCount = SendMessage(hWnd, LVM_GETITEMCOUNT, 0, 0)
End Function
Private Function ListView_GetItem(hWnd As Long, pitem As LVITEM) As Boolean
ListView_GetItem = SendMessage(hWnd, LVM_GETITEM, 0, pitem)
End Function
-
Oct 9th, 2008, 12:36 PM
#5
Re: Retrieve items from TaskManager's listview
Where is the handle coming from and is it accurate?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 9th, 2008, 12:44 PM
#6
Re: Retrieve items from TaskManager's listview
Yes it is accurate, I am getting it by using Spy++. I could get the item count by "b = ListView_GetItemCount(hWnd)" so the handle is correct. Got any hints there gangsta?
-
Oct 9th, 2008, 02:11 PM
#7
Re: Retrieve items from TaskManager's listview
de-u
Code:
hWnd = HexToDec("000D03E6")
how did you get this number 000D03E6 ?
-
Oct 9th, 2008, 02:14 PM
#8
Re: Retrieve items from TaskManager's listview
ooOos, how did i missed that robs question and the answer for that
-
Oct 9th, 2008, 03:35 PM
#9
Re: Retrieve items from TaskManager's listview
Seems the task manager may be protected from messages as everytime I try to read it it will crash the task manager but if I read any other listview, like Explorer, it doesnt crash.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 9th, 2008, 03:38 PM
#10
Re: Retrieve items from TaskManager's listview
Yes, that is what happening when I am trying also. I am hoping there is a workaround to this...
-
Oct 9th, 2008, 04:14 PM
#11
Re: Retrieve items from TaskManager's listview
Last edited by Edgemeal; Mar 5th, 2009 at 01:12 PM.
-
Oct 10th, 2008, 04:27 AM
#12
Re: Retrieve items from TaskManager's listview
Thanks! Will try it out later on...
-
Mar 5th, 2009, 12:02 PM
#13
Addicted Member
Re: [RESOLVED] Retrieve items from TaskManager's listview
Code:
Module1.bas (9.5 KB, 17 views)
i use this code and return is valid but after 10-15 minute return is 0
(that hwnd is ok and that program have a item in listview)
why?
-
Mar 5th, 2009, 01:11 PM
#14
Re: [RESOLVED] Retrieve items from TaskManager's listview
 Originally Posted by kakablack
Code:
Module1.bas (9.5 KB, 17 views)
i use this code and return is valid but after 10-15 minute return is 0
(that hwnd is ok and that program have a item in listview)
why?
I go that module from another forum a long time ago and never really had a use for it so can't say what the problem may be.
But ya there seems to be a problem with it if you keep calling it, I just tried calling it in a loop (from a timer set to 1sec) pointed to task managers listview and eventually all it returned was the Handle, the col and row counts, but no item data.
I'll delete that file it must be buggy! SORRY!
-
Mar 6th, 2009, 02:37 AM
#15
Addicted Member
Re: [RESOLVED] Retrieve items from TaskManager's listview
I go that module from another forum a long time ago and never really had a use for it so can't say what the problem may be.
But ya there seems to be a problem with it if you keep calling it, I just tried calling it in a loop (from a timer set to 1sec) pointed to task managers listview and eventually all it returned was the Handle, the col and row counts, but no item data.
I'll delete that file it must be buggy! SORRY!
now what can i do for it?
i used this module.
?
-
Mar 6th, 2009, 03:39 AM
#16
Addicted Member
Re: [RESOLVED] Retrieve items from TaskManager's listview
Code:
VirtualFreeEx hProc, ByVal lxprocLVITEM, LenB(LVITEM), MEM_RELEASE
CloseHandle hProc
whats this?
maybe it can RESOLVE my problem?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|