| View previous topic :: View next topic |
| Author |
Message |
Zerith Master Cheater
Reputation: 1
Joined: 07 Oct 2007 Posts: 468
|
Posted: Sun Feb 22, 2009 3:22 am Post subject: ListView images and columns |
|
|
Hi,
I want to create something similar to Cheat Engine's process list, a list with images and columns, like in LordPE for example, there's:
| Code: | Path | PID |Whatever|...
C:\... xx... .......... |
I couldn't find anything about working with ListViews and headers.
Could anyone give me an example on how to create something like this?
I'm using resources right now, but Win32 APIs would be good too.
Thanks.
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
|
| Back to top |
|
 |
Zerith Master Cheater
Reputation: 1
Joined: 07 Oct 2007 Posts: 468
|
Posted: Sun Feb 22, 2009 10:55 am Post subject: |
|
|
I was looking for header control but I couldn't find any references for it, but now I see the in the list: Header Control.
Thanks.
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sun Feb 22, 2009 11:05 am Post subject: |
|
|
You can just use ListView with the style LVS_REPORT and send LVM_INSERTCOLUMN to add headers to it.
_________________
|
|
| Back to top |
|
 |
Zerith Master Cheater
Reputation: 1
Joined: 07 Oct 2007 Posts: 468
|
Posted: Sun Feb 22, 2009 11:28 am Post subject: |
|
|
Ok, thanks, but right now I'm having troubles inserting normal items...
This is what I've done:
| Code: | LVITEM Item;
Item.pszText = L"Hello";
Item.mask = LVIF_TEXT;
ListView_InsertItem(GetDlgItem(hWnd, IDC_LIST1), &Item); |
Doesn't seem to work... any idea what might be the problem?
Edit:
I'm having another problem right now.
I've added an icon to the resources but it doesn't set the icon by default, I have to send the WM_SETICON message.
I remember I had default icons before, why do I have to set the icon manually now?
| Code: | IDI_ICON1 ICON "Icon.ico"
...
...
HICON Icon = LoadIcon(GetModuleHandle(0), MAKEINTRESOURCE(IDI_ICON1));
SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)Icon);
DestroyIcon(Icon); |
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sun Feb 22, 2009 12:09 pm Post subject: |
|
|
In your WNDCLASSEX struct set the hIcon member to the LoadIcon.
As for the Item, you have to fill the members: cchTextMax, iItem, and iSubItem if your going to have it be in a column that isn't the first. If you want to insert a subitem you must use ListView_SetItem.
_________________
|
|
| Back to top |
|
 |
Zerith Master Cheater
Reputation: 1
Joined: 07 Oct 2007 Posts: 468
|
Posted: Sun Feb 22, 2009 12:30 pm Post subject: |
|
|
I'm using DialogBox... so I guess there's no default icon, so I have to send WM_SETICON message?
And I'm not trying to insert the item on another column, just the first. (haven't even created columns yet)
Well, I still can't make it work. what should the mask be then? I'm just using LVIF_TEXT.
Could you show an example?
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sun Feb 22, 2009 3:28 pm Post subject: |
|
|
Well there's your problem, in Report view (Details) you have to add the headers before you can add an item.
_________________
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Mon Feb 23, 2009 5:37 am Post subject: |
|
|
You need to use TIcon structure and to get the file's Icon, use the Shell API SHGetFileInfo(), it will contain icon member (SMALL_ICON), make sure your ListView is Report view style.
to insert the icon, use ListView.SetImageIndex();
as for adding to the sub-columns, use SubItem.Add().
|
|
| Back to top |
|
 |
Zerith Master Cheater
Reputation: 1
Joined: 07 Oct 2007 Posts: 468
|
Posted: Mon Feb 23, 2009 5:41 am Post subject: |
|
|
This is not Delphi...
Lurc: thanks, I will try that.
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Mon Feb 23, 2009 5:45 am Post subject: |
|
|
| Zerith wrote: | This is not Delphi...
Lurc: thanks, I will try that. |
erm, sorry then.
|
|
| Back to top |
|
 |
|