cs_billbaxter
Messages postés
11
Date d'inscription
mercredi 13 juillet 2005
Statut
Membre
Dernière intervention
27 juillet 2005
16 juil. 2005 à 00:17
Salut,
A mon avis 2 problèmes :
1) Il manque l'ID du contrôle :
hMenu
<DD>[in] Handle to a menu, or specifies a child-window identifier, depending on the window style. For an overlapped or pop-up window, hMenu identifies the menu to be used with the window; it can be NULL if the class menu is to be used. For a child window, hMenu specifies the child-window identifier, an integer value used by a dialog box control to notify its parent about events. The application determines the child-window identifier; it must be unique for all child windows with the same parent window. </DD>
Voici un exemple de listview que j'ai créé :
hwndListe = CreateWindowEx (WS_EX_CLIENTEDGE, "SysListView32", "",
WS_BORDER | WS_CHILD | WS_VISIBLE | LVS_REPORT | LVS_SINGLESEL | LVS_SORTASCENDING,
0, 0, 100, 100, hwnd, (HMENU)101, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), 0);
2) Il manque l'indice de la colonne (ou sub_item)
LV_COLUMN lvColumn;
lvColumn.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM ;
lvColumn.fmt = LVCFMT_LEFT;
lvColumn.cx = 80;
lvColumn.pszText = "IP";
lvColumn.iSubItem = 0 ;
if( ListView_InsertColumn(hListView,0,(LPARAM)&lvColumn) == -1 )
MessageBox(hWnd,"Erreur lors de la création de la première colonne","Erreur !",MB_OK);
lvColumn.cx = 10;
lvColumn.pszText = "Port";
lvColumn.iSubItem = 1 ;
if( ListView_InsertColumn(hListView,1,(LPARAM)&lvColumn) == -1 )
MessageBox(hWnd,"Erreur lors de la création de la deuxième colonne","Erreur !",MB_OK);
<HR>
NB : tu peux te passer de memset (inutile !)
memset(Buffer,0,sizeof(Buffer));
sprintf(Buffer,"Erreur lors de la création du contrôle ListView : %i",GetLastError());
<HR>
A confirmer tout ça, bonne chance