Bonjour,
voila j'ai creer cette fonction pour inserer du texte dans ma list view, mais bon il me retourne -1 des la fonction ListView_InsertItem();
Mais bon comme c'est du code que j'ais modifie j'ais encore du faire une connerie.
BOOL userEditDlg::addUserListMapWay(std::string lector, std::string server, std::string share)
{
char* temp;
//Initialisation de la Structure de la ListView
LVITEM LvItem;
LvItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE;
LvItem.state = 0;
LvItem.stateMask = 0;
LvItem.iItem = 0; //numéro de l'item
LvItem.lParam = 0; //Sert lors d'un tri
LvItem.iSubItem = 0; //index dans la ligne
char *buff;
buff=(char*)malloc(sizeof(char)*4);
//SendDlgItemMessage(this->hUserEditDlg, IDC_USER_EDIT_USER_LIST, LVM_INSERTITEM, itemPos, (LPARAM)&LvItem);
int itemPos = ListView_InsertItem(this->hUserEditUserList,(LPARAM)&LvItem);
itoa(itemPos,buff,10);
MessageBox(NULL,buff,"test",MB_OK);
temp = (char*)malloc(sizeof(char)*lector.length()+1);
strcpy(temp,lector.c_str());
//Lecteur
MessageBox(NULL,temp,"test",MB_OK);
ListView_SetItemText(this->hUserEditUserList,itemPos,0,temp);
free(temp);
//Serveur
temp = (char*)malloc(sizeof(char)*server.length()+1);
strcpy(temp,server.c_str());
MessageBox(NULL,temp,"test",MB_OK);
ListView_SetItemText(this->hUserEditUserList,itemPos,1,temp);
free(temp);
//Partage
temp = (char*)malloc(sizeof(char)*share.length()+1);
strcpy(temp,share.c_str());
MessageBox(NULL,temp,"test",MB_OK);
ListView_SetItemText(this->hUserEditUserList,itemPos,2,temp);
free(temp);
// SetFocus(this->hUserEditUserList);
UpdateWindow(this->hUserEditDlg);
return true;
}
merci