i have added #include <commctrl.h> .inspite of ImageList_Create,ImageList_AddIcon,ListView_SetImageList gives linking error.
The commented red code is not supported,
#include <commctrl.h>
the code is following.
case WM_INITDIALOG:
{ int i;
char Temp[255];
char * buff = new char[5000];
string xmlbuffer,Pathforfile,PATH;
Registry objReg;
ifstream in;
Utility util;
hList=GetDlgItem(hDlg,IDC_LIST4);
HIMAGELIST hSmall;
HICON hIcon;
<code>
</code>
LvCol.mask =LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM | LVIF_STATE;
LvCol.iSubItem = 0;
LvCol.pszText = _T("Image");
LvCol.cx=0x58;
ListView_InsertColumn(hList, 0, &LvCol);
LvCol.pszText=_T("File");
SendMessage(hList,LVM_INSERTCOLUMN,1,(LPARAM)&LvCol);
LvCol.pszText=_T("Extension");
SendMessage(hList,LVM_INSERTCOLUMN,2,(LPARAM)&LvCol);
LvCol.pszText=_T("Location");
SendMessage(hList,LVM_INSERTCOLUMN,3,(LPARAM)&LvCol);
LvCol.pszText=_T("Size");
SendMessage(hList,LVM_INSERTCOLUMN,4,(LPARAM)&LvCol);
LvCol.pszText=_T("Duration");
SendMessage(hList,LVM_INSERTCOLUMN,5,(LPARAM)&LvCol);
LvCol.pszText=_T("Bit Rate");
SendMessage(hList,LVM_INSERTCOLUMN,6,(LPARAM)&LvCol);
LvCol.pszText=_T("Type");
SendMessage(hList,LVM_INSERTCOLUMN,7,(LPARAM)&LvCol);
LvCol.pszText=_T("Modified Date");
SendMessage(hList,LVM_INSERTCOLUMN,8,(LPARAM)&LvCol);
LvCol.pszText=_T("Progress");
SendMessage(hList,LVM_INSERTCOLUMN,9,(LPARAM)&LvCol);
LvCol.pszText=_T("Protected");
SendMessage(hList,LVM_INSERTCOLUMN,10,(LPARAM)&LvCol);
memset(&LvItem,0,sizeof(LvItem));
LvItem.mask=LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM | LVIF_STATE;
LvItem.cchTextMax = 256;
ListView_SetItemState(hList,0,LVIS_SELECTED ,LVIF_STATE);
Pathforfile = objReg.GetRegistryKeyEntryValue(TEXT("SOFTWARE\\DRM"),TEXT("InstallDIR"));
PATH=Pathforfile+"Encoder"+username+SITE_ID+".xml";
in.open((PATH.c_str()), ios::in);
char str[2000];
string outstring;
WCHAR w_UploadedFile[MAX_PATH];
bool onoff=in.is_open();
if(onoff)
{
while(in >> str)
outstring+=str;
char *token;
char *tok = strtok_s((char*)outstring.c_str(),"<>",&token);
while(tok)
{
if(tok == NULL)
break;
else
{
string tmp = tok;
if(tmp.find("type") != -1)
{
{
size_t pos1 = tmp.find_first_of("=");
if(pos1 != -1)
{
string tmpType = tmp.substr(pos1 + 2);
size_t pos2 = tmpType.find_first_of("\"");
if(pos2 != -1)
{
string inputtype = tmpType.substr(0,pos2);
if(inputtype=="dir")
{
if(tmp.find("order") != -1)
{
size_t pos1 = tmp.find_last_of("=");
string tmporder = tmp.substr(pos1 + 2);
size_t pos2 = tmporder.find_last_of("\"");
string inputorder = tmporder.substr(0,pos2);
int i=atoi(inputorder.c_str());
tok = strtok_s(NULL,"<>",&token);
tmp=tok;
if(tmp.find("path") != -1)
{
tok = strtok_s(NULL,"<>",&token);
string filename=tok;
WCHAR* IRPATH=util.ConvertStringToWCHAR(filename.c_str()); MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,filename.c_str(),(int)(filename.length() + 1),w_UploadedFile,MAX_PATH);
LvItem.iItem=i;
LvItem.iSubItem=0;
<big>LvItem.iImage = 0;
LvItem.mask = LVIF_TEXT|LVIF_IMAGE;
LvItem.pszText=(LPWSTR)w_UploadedFile; </big> SendMessage(hList,LVM_INSERTITEM,0,(LPARAM)&LvItem);
}
tok = strtok_s(NULL,"<>",&token);
tok = strtok_s(NULL,"<>",&token);
tmp=tok;
if(tmp.find("Protected")!=-1)
{
tok=strtok_s(NULL,"<>",&token);
WCHAR* protec=util.ConvertStringToWCHAR(tok);
LvItem.pszText=(LPWSTR)protec;
LvItem.iSubItem=8;
SendMessage(hList,LVM_SETITEM,0,(LPARAM)&LvItem);
}
}
}else if(inputtype=="file")
{
int j=0;
if(tmp.find("order") != -1)
{
size_t pos1 = tmp.find_last_of("=");
string tmporder = tmp.substr(pos1 + 2);
size_t pos2 = tmporder.find_last_of("\"");
string inputorder = tmporder.substr(0,pos2);
int i=atoi(inputorder.c_str());
tok = strtok_s(NULL,"<>",&token);
tmp=tok;
if(tmp.find("filename") != -1)
{
tok = strtok_s(NULL,"<>",&token);
string filename=tok;
WCHAR* DIRPATH=util.ConvertStringToWCHAR(tok);
MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,filename.c_str(),(int)(filename.length() + 1),w_UploadedFile,MAX_PATH);
}
LvItem.iItem=i;
<big>LvItem.iSubItem=0;
LvItem.iImage = 0;
LvItem.mask = LVIF_TEXT|LVIF_IMAGE;
LvItem.pszText=(LPWSTR)w_UploadedFile;
SendMessage(hList,LVM_INSERTITEM,0,(LPARAM)&LvItem);
</big> for(j=1;j<=8;j++)
{
tok = strtok_s(NULL,"<>",&token);
tok = strtok_s(NULL,"<>",&token);
tok = strtok_s(NULL,"<>",&token);
if(j==7)
{
string filename=tok;
if(filename=="P")
filename=" ";
WCHAR* DIRPATH=util.ConvertStringToWCHAR(filename.c_str());
LvItem.pszText=(LPWSTR)DIRPATH;
}else
{
WCHAR* DIRPATH=util.ConvertStringToWCHAR(tok);
LvItem.pszText=(LPWSTR)DIRPATH;
}
LvItem.iSubItem=j;
SendMessage(hList,LVM_SETITEM,0,(LPARAM)&LvItem);
}
}
}
}
}
}
}
}
tok = strtok_s(NULL,"<>",&token);
}
}
in.close();
}
break;
|