voilà j'ai créer ma listview j'ai en fin un truc de moi meme, mais bon j'avais de l'aide quand meme seulement ya un hic donc si l'on pouvait m'aider, j'ai beau essayer de cherché je trouve pas :(
erreurs:
C:\Documents and Settings\julian\Bureau\projet\prog\nouveau programme\main.cpp:48: error: `LPNMLVGETINFOTIPA' was not declared in this scope
C:\Documents and Settings\julian\Bureau\projet\prog\nouveau programme\main.cpp:48: error: expected `;' before "nmInfoTip"
C:\Documents and Settings\julian\Bureau\projet\prog\nouveau programme\main.cpp:52: error: `nmInfoTip' was not declared in this scope
C:\Documents and Settings\julian\Bureau\projet\prog\nouveau programme\main.cpp:52: error: expected `;' before "lParam"
C:\Documents and Settings\julian\Bureau\projet\prog\nouveau programme\main.cpp:67: error: `hWnd' was not declared in this scope
C:\Documents and Settings\julian\Bureau\projet\prog\nouveau programme\main.cpp: In function `int createImgList()':
C:\Documents and Settings\julian\Bureau\projet\prog\nouveau programme\main.cpp:83: error: a function-definition is not allowed here before '{' token
C:\Documents and Settings\julian\Bureau\projet\prog\nouveau programme\main.cpp:116: error: a function-definition is not allowed here before '{' token
C:\Documents and Settings\julian\Bureau\projet\prog\nouveau programme\main.cpp:140: error: a function-definition is not allowed here before '{' token
C:\Documents and Settings\julian\Bureau\projet\prog\nouveau programme\main.cpp:160: error: expected `}' at end of input
Process terminated with status 1 (0 minutes, 0 seconds)
9 errors, 0 warnings
mon code:
#include <windows.h>
#include <commctrl.h>
#include <tchar.h>
#define _WIN32_IE 0x0400
/*variables, Handles */
HINSTANCE _hThisInstance;
HWND _hWnd;
HWND _hListView;
LPTSTR _lpAppName = _T("mon programme");
DWORD _nStatusBarHeight;
/*traitement des messages*/
int CALLBACK windowsprocedure(HWND hwnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
/*Info sur les tailles min et max de la fenêtre*/
MINMAXINFO *lpMinMaxInfo;
/*Taille de la zone cliente*/
RECT clientRect;
/*retour de la fonction*/
long nResult;
nResult = 0;
/*Pour savoir si le message est traité*/
int bHandled;
bHandled = 0;
switch (nMsg)
{
case WM_GETMINMAXINFO:
lpMinMaxInfo = (MINMAXINFO*)lParam;
lpMinMaxInfo->ptMinTrackSize.x = 300;
lpMinMaxInfo->ptMinTrackSize.y = 200;
bHandled = 1;
break;
/* On ajuste la taille de la listview */
GetClientRect(_hWnd, &clientRect);
SetWindowPos(_hListView, 0, 0, 0,
clientRect.right - clientRect.left,
clientRect.bottom - clientRect.top - _nStatusBarHeight,
SWP_NOMOVE | SWP_NOZORDER);
break;
/*affichage de la notification*/
LPNMLVGETINFOTIP nmInfoTip
case WM_NOTIFY:
if (((NMHDR*)lParam)->code == LVN_GETINFOTIP);
{
nmInfoTip = (LPNMLVGETINFOTIP)lParam;
MessageBox(_hWnd, nmInfoTip->pszText, "informations disponibles", MB_OK);
}
break;
case WM_DESTROY:
/* On signale que le thread va s'arrêter */
PostQuitMessage(0);
bHandled = 1;
break;
}
if (! bHandled)
nResult = DefWindowProc(hWnd, nMsg, wParam, lParam);
return nResult;
}
/*cration de la liste d'images*/
int createImgList()
{
HIMAGELIST hImageList;
hImageList = ImageList_Create(GetSystemMetrics(SM_CXICON),
GetSystemMetrics(SM_CYICON),
ILC_MASK, 1, 1);
int createItems()
{
LVITEM item;
/*ajout d'icones*/
LVItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
LVItem.iItem = Item;
LVItem.iSubItem = 0;
LVItem.pszText = FichDossARec.NomFichDoss;
LVItem.cchTextMax = sizeof(FichDossARec.NomFichDoss);
LVItem.lParam = (LPARAM)IndexExt;
LVItem.iImage = 2;
/*initialisation*/
{
lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE;
lvi.state = 0;
lvi.stateMask = 0;
lvi.cchTextMax = strlen(text);
lvi.pszText = text;
lvi.iImage = 0;
lvi.iItem = 0;
lvi.iSubItem = 0;
SendMessage(ListViewhWnd[2], LVM_INSERTITEM, 0, (LPARAM)&LVItem);
}
if (! hImageList) goto the_end;
the_end :
return 0 ;
}
/*ajout de la listview*/
int CreateListView()
{
_hListView = CreateWindowEx(0, WC_LISTVIEW, (LPCTSTR)NULL,WS_CHILD | LVS_ICON | WS_VISIBLE,0, 0, 0, 0,_hWnd, NULL, _hThisInstance, NULL);
if (! _hListView) goto the_end;
/*handle pour les tooltips*/
HWND hTips;
/*envoie des message lors du survol des items */
SendMessage(_hListView, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_INFOTIP, LVS_EX_INFOTIP);
/* Pour que WM_NOTIFY arrivent instantanément lors du survol d'un item */
hTips = (HWND)SendMessage(_hListView, LVM_GETTOOLTIPS, 0, 0);
SendMessage(hTips, TTM_SETDELAYTIME, TTDT_INITIAL, 1);
SendMessage(hTips, TTM_SETDELAYTIME, TTDT_RESHOW, 1);
if (! CreateImgList()) goto the_end;
if (! CreateItems()) goto the_end;
the_end :
return 0 ;
}
/*fenètre principale*/
int WinMain (HINSTANCE cetteInstance, HINSTANCE precedenteInstance,
LPSTR lignesDeCommande, int modeDAffichage)
{
HWND fenetrePrincipale;
MSG message;
WNDCLASS classeFenetre;
classeFenetre.style = 0;
classeFenetre.lpfnWndProc = procedureFenetrePrincipale;
classeFenetre.cbClsExtra = 0;
classeFenetre.cbWndExtra = 0;
classeFenetre.hInstance = NULL;
classeFenetre.hIcon = LoadIcon(NULL, IDI_APPLICATION);
classeFenetre.hCursor = LoadCursor(NULL, IDC_ARROW);
classeFenetre.hbrBackground = (HBRUSH)(1 + COLOR_BTNFACE);
classeFenetre.lpszMenuName = 0;
classeFenetre.lpszClassName = "_lpAppName";
/*affichage de la fenetre*/
ShowWindow(fenetrePrincipale, modeDAffichage);
UpdateWindow(fenetrePrincipale);
return 0 ;
}