Click here to Skip to main content
15,916,288 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Radio Buttons in VS2005 Pin
Rama Krishna Vavilala1-Feb-07 4:44
Rama Krishna Vavilala1-Feb-07 4:44 
AnswerRe: Radio Buttons in VS2005 Pin
Rama Krishna Vavilala1-Feb-07 4:43
Rama Krishna Vavilala1-Feb-07 4:43 
QuestionGetting co-ordinates of HDC Pin
priyank_ldce31-Jan-07 3:58
priyank_ldce31-Jan-07 3:58 
AnswerRe: Getting co-ordinates of HDC Pin
Mark Salsbery31-Jan-07 6:56
Mark Salsbery31-Jan-07 6:56 
AnswerRe: Getting co-ordinates of HDC Pin
Hamid_RT31-Jan-07 20:24
Hamid_RT31-Jan-07 20:24 
QuestionRe: Getting co-ordinates of HDC Pin
priyank_ldce31-Jan-07 22:54
priyank_ldce31-Jan-07 22:54 
QuestionRe: Getting co-ordinates of HDC Pin
Hamid_RT1-Feb-07 0:28
Hamid_RT1-Feb-07 0:28 
Questionhelp me to display list view from xml Pin
amitmistry_petlad 31-Jan-07 2:41
amitmistry_petlad 31-Jan-07 2:41 
in my application i have made XML file .
i have read it and stored content in the string after cheking the tokens i fetched the values according to the tokens and put that values in the listview.

as per following.(first folder is selected , and then file selected)
LISTVIEW
---------------------------------------------------------------------------------------------------
File | Extension | size | Duration | Bitrate | Type | ModifiedDate | protected

D:\amit\ - - - - - - -
amit.wmv wmv 296KB 00:30:00 495kbps Window 7/7/2007 completed
Media
File
====================================================================================================

xml file is below.
------------------------------
<filelist>
<listitem type="dir" order="0">
<path>D:\amit\</path>
</listitem>
<listitem type="file" order="1">
<filename>C:\Documents and Settings\Amit\Desktop\MediaFiles\TT.wmv</filename>
<extension>wmv</extension>
<size>494 KB</size>
<Duration>00:00:38</Duration>
<Bitrate>103 Kbps</Bitrate>
<Type>Windows Media Audio/Video file</Type>
<modifydated>11/22/2005</modifydated>
</listitem>
</filelist>

=============================================================
Code for that is below
when user logged.
at first time the xml file will be read.



switch (message)
{
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); // get the ID of the ListView
memset(&plvbki,0,sizeof(plvbki));


SendMessage(hList,LVM_SETEXTENDEDLISTVIEWSTYLE,0,LVS_EX_FULLROWSELECT); // Set style

memset(&LvCol,0,sizeof(LvCol)); // Reset Coluom
LvCol.mask=LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM; // Type of mask
LvCol.cx=0x58; // width between each coloum
LvCol.pszText=_T("File"); // First Header
LvCol.cx=0x52;
// Inserting Couloms as much as we want
SendMessage(hList,LVM_INSERTCOLUMN,0,(LPARAM)&LvCol); // Insert/Show the coloum
LvCol.pszText=_T("Extension"); // Next coloum
SendMessage(hList,LVM_INSERTCOLUMN,1,(LPARAM)&LvCol); // ...
LvCol.pszText=_T("Size"); //
SendMessage(hList,LVM_INSERTCOLUMN,2,(LPARAM)&LvCol); //
LvCol.pszText=_T("Duration"); //
SendMessage(hList,LVM_INSERTCOLUMN,3,(LPARAM)&LvCol); //
LvCol.pszText=_T("Bit Rate"); //
SendMessage(hList,LVM_INSERTCOLUMN,4,(LPARAM)&LvCol); //
LvCol.pszText=_T("Type"); //
SendMessage(hList,LVM_INSERTCOLUMN,5,(LPARAM)&LvCol); //
LvCol.pszText=_T("Modified Date"); //
SendMessage(hList,LVM_INSERTCOLUMN,6,(LPARAM)&LvCol); //
LvCol.pszText=_T("Progress"); //
SendMessage(hList,LVM_INSERTCOLUMN,7,(LPARAM)&LvCol);//
LvCol.pszText=_T("Protected"); //
SendMessage(hList,LVM_INSERTCOLUMN,8,(LPARAM)&LvCol);//
memset(&LvItem,0,sizeof(LvItem)); // Reset Item Struct
// Setting properties Of Items:
LvItem.mask=LVIF_TEXT; // Text Style
LvItem.cchTextMax = 256; // Max size of test
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;
bool onoff=in.is_open();
if(onoff)
{
//xmlbuffer.c_str();
//in.read((char *)&xmlbuffer, sizeof(xmlbuffer));
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;
// Check for the <Profile> Node.
if(tmp.find("type") != -1)
{
//Get the profile Name and store in the vector;
{
size_t pos1 = tmp.find_first_of("=");
if(pos1 != -1)
{
string tmpType = tmp.substr(pos1 + 2); //value of tmpProName would be: profileName" ID="ENCRYPTEDID">
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()); //find the order for display in the list view



tok = strtok_s(NULL,"<>",&token);
tmp=tok;
if(tmp.find("path") != -1)
{
tok = strtok_s(NULL,"<>",&token);
string filename=tok;
WCHAR* DIRPATH=util.ConvertStringToWCHAR(tok);
LvItem.pszText=(LPWSTR)DIRPATH;
//SendMessage(hList,LVM_SETITEM,0,(LPARAM)&LvItem);
ListView_SetItemText(hList,i,0,(LPWSTR)&LvItem); // put the listview value from here
}
/*
if(inputtype=="file")
{
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;
}
tok = strtok_s(NULL,"<>",&token);
tmp=tok;
if()
*/

}

}

}
}
}
/*
if(tmp.find("order") !=-1)
{
size_t pos1 = tmp.find_first_of("=");
}
*/
}
//tok = strtok_s(NULL,"<>",&token);
}

//////////////////////////end add by amit
tok = strtok_s(NULL,"<>",&token);
}

}
in.close();

//DeleteFile(mainfilename);



}
break;













AnswerRe: help me to display list view from xml Pin
Laxman Auti31-Jan-07 3:00
Laxman Auti31-Jan-07 3:00 
GeneralRe: help me to display list view from xml Pin
amitmistry_petlad 31-Jan-07 3:16
amitmistry_petlad 31-Jan-07 3:16 
GeneralRe: help me to display list view from xml Pin
_anil_31-Jan-07 3:38
_anil_31-Jan-07 3:38 
GeneralRe: help me to display list view from xml Pin
James R. Twine31-Jan-07 4:00
James R. Twine31-Jan-07 4:00 
AnswerRe: help me to display list view from xml Pin
Michael Dunn31-Jan-07 9:57
sitebuilderMichael Dunn31-Jan-07 9:57 
GeneralRe: help me to display list view from xml Pin
amitmistry_petlad 31-Jan-07 22:51
amitmistry_petlad 31-Jan-07 22:51 
GeneralRe: help me to display list view from xml Pin
amitmistry_petlad 1-Feb-07 16:45
amitmistry_petlad 1-Feb-07 16:45 
GeneralRe: help me to display list view from xml Pin
Michael Dunn1-Feb-07 18:37
sitebuilderMichael Dunn1-Feb-07 18:37 
GeneralRe: help me to display list view from xml Pin
amitmistry_petlad 1-Feb-07 19:17
amitmistry_petlad 1-Feb-07 19:17 
GeneralRe: help me to display list view from xml Pin
Michael Dunn1-Feb-07 19:22
sitebuilderMichael Dunn1-Feb-07 19:22 
GeneralRe: help me to display list view from xml Pin
amitmistry_petlad 1-Feb-07 19:34
amitmistry_petlad 1-Feb-07 19:34 
QuestionInserting data to SQL server problem Pin
_anil_31-Jan-07 2:20
_anil_31-Jan-07 2:20 
QuestionRe: Inserting data to SQL server problem Pin
David Crow31-Jan-07 2:51
David Crow31-Jan-07 2:51 
AnswerRe: Inserting data to SQL server problem Pin
_anil_31-Jan-07 3:28
_anil_31-Jan-07 3:28 
QuestionShading in regions of a graph Pin
TheDelChop31-Jan-07 2:07
TheDelChop31-Jan-07 2:07 
AnswerRe: Shading in regions of a graph Pin
Michael Dunn31-Jan-07 3:20
sitebuilderMichael Dunn31-Jan-07 3:20 
Questionbind function in SDK Pin
vibindia31-Jan-07 1:25
vibindia31-Jan-07 1:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.