Jan 26th, 2003, 09:34 PM
#1
Thread Starter
Frenzied Member
Listview
I searched on msdn on list view but i get these complex sample which i cant understand can some teach me or post some code on :
How to create a listview
how to create columns
how to add info to the columns and
how to get info from them
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
Jan 27th, 2003, 12:27 AM
#2
Hyperactive Member
Adding a new column:
Code:
void Lv_AddColumn(HWND hWnd, LPSTR lpText, UINT uWidth, UINT uID)
{
//variable
LVCOLUMN lvc;
//create item
lvc.mask = LVCF_TEXT | LVCF_WIDTH;
lvc.pszText = lpText;
lvc.cx = uWidth;
//insert column
ListView_InsertColumn(hWnd, uID, &lvc);
}
Jan 27th, 2003, 12:33 AM
#3
Thread Starter
Frenzied Member
thanks but i would i create the listview to use that with>?
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
Jan 27th, 2003, 01:14 AM
#4
Hyperactive Member
Here you go:
Code:
hList = CreateWindowEx(WS_EX_CLIENTEDGE, "SysListView32", NULL, WS_BORDER | WS_CHILD | WS_VISIBLE | LVS_REPORT, 0, 0, 0, 0, hWnd, NULL, hInst, 0);
Jan 27th, 2003, 06:22 AM
#5
Thread Starter
Frenzied Member
i get a error on LVS_REPORT
VB Code:
E:\Program Files\Microsoft Visual Studio\MyProjects\Menu1\Main.cpp(72) : error C2065: 'LVS_REPORT' : undeclared identifier
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
Jan 27th, 2003, 07:43 AM
#6
Hyperactive Member
Did you include commctrl.h and import comctl32.lib?
Jan 27th, 2003, 12:00 PM
#7
And you must call InitializeCommonControls or InitializeCommonControlsEx
All the buzzt
CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Jan 27th, 2003, 12:29 PM
#8
Thread Starter
Frenzied Member
how do i import that comctl32.lib?
and how do i call InitializeCommonControls
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
Jan 27th, 2003, 12:34 PM
#9
Thread Starter
Frenzied Member
with the code below . what is the UINT uID?
VB Code:
void Lv_AddColumn(HWND hWnd, LPSTR lpText, UINT uWidth, UINT uID)
{
//variable
LVCOLUMN lvc;
//create item
lvc.mask = LVCF_TEXT | LVCF_WIDTH;
lvc.pszText = lpText;
lvc.cx = uWidth;
//insert column
ListView_InsertColumn(hWnd, uID, &lvc);
}
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
Jan 27th, 2003, 12:40 PM
#10
Thread Starter
Frenzied Member
i see the column part but cant seem to add column
VB Code:
#define IDC_MAIN_HLIST 102
VB Code:
hList = CreateWindowEx(WS_EX_CLIENTEDGE, "SysListView32", NULL, WS_BORDER | WS_CHILD | WS_VISIBLE | LVS_REPORT , 40, 40, 200, 200, hwnd, (HMENU)IDC_MAIN_HLIST, GetModuleHandle(NULL), 0);
int lWidth;
lWidth = 1440;
Lv_AddColumn(hwnd,"jason",lWidth,IDC_MAIN_HLIST);
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
Jan 27th, 2003, 03:23 PM
#11
Thread Starter
Frenzied Member
can someone tell me how to add a column and test to the subitems
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
Jan 27th, 2003, 08:46 PM
#12
Hyperactive Member
void Lv_AddColumn(HWND hWnd, LPSTR lpText, UINT uWidth, UINT uID)
{
//variable
LVCOLUMN lvc;
//create item
lvc.mask = LVCF_TEXT | LVCF_WIDTH;
lvc.pszText = lpText;
lvc.cx = uWidth;
//insert column
ListView_InsertColumn(hWnd, uID, &lvc);
}
HWND = Handle to list view
LPSTR = Text
UINT uWidth = Width
uID = ID of a column. Each column is increased in ID starting with 1. In your case just put one.
Jan 27th, 2003, 09:05 PM
#13
Thread Starter
Frenzied Member
doh , thanks alot
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
Jan 27th, 2003, 10:35 PM
#14
Thread Starter
Frenzied Member
I got this really wierd problem. I got it the first time and it still
works on that program but i follow what i did and try to make it again and no good. here are the basic lines i add
VB Code:
#include <windows.h>
#include <commctrl.h>
HWND hList;
hList = CreateWindowEx(WS_EX_CLIENTEDGE, "SysListView32", NULL, WS_BORDER | WS_CHILD | WS_VISIBLE | LVS_REPORT, 0, 0, 200,200, hwnd, NULL, GetModuleHandle(NULL), 0);
Lv_AddColumn(hList,"Jason",90,1);
Lv_AddColumn(hList,"Lpz",90,2);
//thats to add the listview
void Lv_AddColumn(HWND hWnd, LPSTR lpText, UINT uWidth, UINT uID)
{
//variable
LVCOLUMN lvc;
//create item
lvc.mask = LVCF_TEXT | LVCF_WIDTH;
lvc.pszText = lpText;
lvc.cx = uWidth;
//insert column
ListView_InsertColumn(hWnd, uID, &lvc);
}
//to add column
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
Jan 27th, 2003, 10:38 PM
#15
Thread Starter
Frenzied Member
Attached Files
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
Jan 27th, 2003, 10:48 PM
#16
Thread Starter
Frenzied Member
As i thought it was my stupid PC its sick i had to restart it works great now lol thanks alot again
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
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