Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


ListView images and columns

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Zerith
Master Cheater
Reputation: 1

Joined: 07 Oct 2007
Posts: 468

PostPosted: Sun Feb 22, 2009 3:22 am    Post subject: ListView images and columns Reply with quote

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
View user's profile Send private message MSN Messenger
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sun Feb 22, 2009 9:53 am    Post subject: Reply with quote

http://msdn.microsoft.com/en-us/library/bb774737.aspx
_________________
Back to top
View user's profile Send private message
Zerith
Master Cheater
Reputation: 1

Joined: 07 Oct 2007
Posts: 468

PostPosted: Sun Feb 22, 2009 10:55 am    Post subject: Reply with quote

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. Smile

Thanks.
Back to top
View user's profile Send private message MSN Messenger
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sun Feb 22, 2009 11:05 am    Post subject: Reply with quote

You can just use ListView with the style LVS_REPORT and send LVM_INSERTCOLUMN to add headers to it.
_________________
Back to top
View user's profile Send private message
Zerith
Master Cheater
Reputation: 1

Joined: 07 Oct 2007
Posts: 468

PostPosted: Sun Feb 22, 2009 11:28 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sun Feb 22, 2009 12:09 pm    Post subject: Reply with quote

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
View user's profile Send private message
Zerith
Master Cheater
Reputation: 1

Joined: 07 Oct 2007
Posts: 468

PostPosted: Sun Feb 22, 2009 12:30 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sun Feb 22, 2009 3:28 pm    Post subject: Reply with quote

Well there's your problem, in Report view (Details) you have to add the headers before you can add an item.
_________________
Back to top
View user's profile Send private message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Mon Feb 23, 2009 5:37 am    Post subject: Reply with quote

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
View user's profile Send private message
Zerith
Master Cheater
Reputation: 1

Joined: 07 Oct 2007
Posts: 468

PostPosted: Mon Feb 23, 2009 5:41 am    Post subject: Reply with quote

This is not Delphi...

Lurc: thanks, I will try that.
Back to top
View user's profile Send private message MSN Messenger
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Mon Feb 23, 2009 5:45 am    Post subject: Reply with quote

Zerith wrote:
This is not Delphi...

Lurc: thanks, I will try that.


erm, sorry then.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites