2 * ReactOS shell32 - Control Panel ListCtrl implementation
6 * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
41 static int _GetSystemDirectory(LPTSTR buffer, int buflen)
44 return GetSystemDirectory(buffer, buflen);
46 return GetCurrentDirectory(buflen, buffer);
47 // if (lstrcpyn(buffer, szTestDirName, buflen - 1)) {
48 // return lstrlen(buffer);
55 ////////////////////////////////////////////////////////////////////////////////
56 // Global and Local Variables:
59 #define MAX_LIST_COLUMNS (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1)
60 static int default_column_widths[MAX_LIST_COLUMNS] = { 250, 500 };
61 static int column_alignment[MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_LEFT };
63 CPlApplet* pListHead; // holds pointer to linked list of cpl modules CPlApplet*
64 //static CPlApplet* pListHead; // holds pointer to linked list of cpl modules CPlApplet*
67 ////////////////////////////////////////////////////////////////////////////////
68 // Local module support methods
71 static void AddAppletsToListView(HWND hwndLV, CPlApplet* pApplet)
76 for (count = 0; count < pApplet->count; count++) {
78 NEWCPLINFO* pCPLInfo = &pApplet->info[count];
81 if (!(pCPlEntry = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pCPlEntry))))
84 pCPlEntry->hWnd = hwndLV;
85 pCPlEntry->nSubProg = count;
86 pCPlEntry->pCPlApplet = pApplet;
88 if (pCPLInfo->hIcon) { // add the icon to an image list
89 HIMAGELIST hImageList;
90 hImageList = ListView_GetImageList(hwndLV, LVSIL_NORMAL);
91 index = ImageList_AddIcon(hImageList, pCPLInfo->hIcon);
92 hImageList = ListView_GetImageList(hwndLV, LVSIL_SMALL);
93 ImageList_AddIcon(hImageList, pCPLInfo->hIcon);
94 DestroyIcon(pCPLInfo->hIcon);
96 item.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE | LVIF_PARAM;
101 // item.pszText = LPSTR_TEXTCALLBACK;
102 // item.cchTextMax = 50;
103 item.pszText = pCPLInfo->szName;
104 item.cchTextMax = _tcslen(item.pszText);
106 item.lParam = (LPARAM)pCPlEntry;
107 #if (_WIN32_IE >= 0x0300)
110 index = ListView_InsertItem(hwndLV, &item);
111 if (index != -1 && pCPLInfo->szInfo != NULL) {
112 ListView_SetItemText(hwndLV, index, 1, pCPLInfo->szInfo);
117 static void CreateListColumns(HWND hwndLV)
124 lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
125 lvC.pszText = szText;
127 // Load the column labels from the resource file.
128 for (index = 0; index < MAX_LIST_COLUMNS; index++) {
129 lvC.iSubItem = index;
130 lvC.cx = default_column_widths[index];
131 lvC.fmt = column_alignment[index];
132 LoadString(hInst, IDS_LIST_COLUMN_FIRST + index, szText, 50);
133 if (ListView_InsertColumn(hwndLV, index, &lvC) == -1) {
134 // TODO: handle failure condition...
140 // InitListViewImageLists - creates image lists for a list view control.
141 // This function only creates image lists. It does not insert the
142 // items into the control, which is necessary for the control to be
144 // Returns TRUE if successful, or FALSE otherwise.
145 // hwndLV - handle to the list view control.
146 static BOOL InitListViewImageLists(HWND hwndLV)
148 // HICON hiconItem; // icon for list view items
149 HIMAGELIST hLarge; // image list for icon view
150 HIMAGELIST hSmall; // image list for other views
152 // Create the full-sized icon image lists.
153 hLarge = ImageList_Create(GetSystemMetrics(SM_CXICON),
154 GetSystemMetrics(SM_CYICON), ILC_MASK, 1, 20);
155 hSmall = ImageList_Create(GetSystemMetrics(SM_CXSMICON),
156 GetSystemMetrics(SM_CYSMICON), ILC_MASK, 1, 20);
158 // Add an icon to each image list.
159 // hiconItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ITEM));
160 // hiconItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONTROL));
161 // ImageList_AddIcon(hLarge, hiconItem);
162 // ImageList_AddIcon(hSmall, hiconItem);
163 // DestroyIcon(hiconItem);
165 /*********************************************************
166 Usually you have multiple icons; therefore, the previous
167 four lines of code can be inside a loop. The following code
168 shows such a loop. The icons are defined in the application's
169 header file as resources, which are numbered consecutively
170 starting with IDS_FIRSTICON. The number of icons is
171 defined in the header file as C_ICONS.
173 for(index = 0; index < C_ICONS; index++) {
174 hIconItem = LoadIcon (hInst, MAKEINTRESOURCE (IDS_FIRSTICON + index));
175 ImageList_AddIcon(hSmall, hIconItem);
176 ImageList_AddIcon(hLarge, hIconItem);
179 *********************************************************/
181 // Assign the image lists to the list view control.
182 ListView_SetImageList(hwndLV, hLarge, LVSIL_NORMAL);
183 ListView_SetImageList(hwndLV, hSmall, LVSIL_SMALL);
187 typedef LONG (WINAPI *CPlApplet_Ptr)(HWND, UINT, LONG, LONG);
189 static void AddEntryToList(HWND hwndLV, LPTSTR szName, LPTSTR szInfo, CPlEntry* pCPlEntry)
195 memset(&item, 0, sizeof(LVITEM));
196 item.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE | LVIF_PARAM;
197 if (szName != NULL) {
198 item.pszText = szName;
199 item.cchTextMax = _tcslen(item.pszText);
200 item.iImage = pCPlEntry->nIconIndex;
202 item.pszText = LPSTR_TEXTCALLBACK;
203 item.cchTextMax = MAX_CPL_NAME;
204 item.iImage = I_IMAGECALLBACK;
206 item.lParam = (LPARAM)pCPlEntry;
207 #if (_WIN32_IE >= 0x0300)
210 index = ListView_InsertItem(hwndLV, &item);
212 if (szInfo != NULL) {
213 ListView_SetItemText(hwndLV, index, 1, szInfo);
215 ListView_SetItemText(hwndLV, index, 1, LPSTR_TEXTCALLBACK);
222 static CPlApplet* Control_LoadApplet(HWND hwndLV, LPTSTR buffer, CPlApplet** pListHead)
225 hCpl = LoadLibrary(buffer);
227 CPlApplet_Ptr pCPlApplet;
228 pCPlApplet = (CPlApplet_Ptr)(FARPROC)GetProcAddress(hCpl, "CPlApplet");
230 if (pCPlApplet(hwndLV, CPL_INIT, 0, 0)) {
231 int nSubProgs = pCPlApplet(hwndLV, CPL_GETCOUNT, 0, 0);
232 if (nSubProgs == 0) {
233 TRACE(_T("No subprogram in applet\n"));
238 if (!(applet = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*applet)))) {
241 applet->next = *pListHead;
244 strncpy(applet->filename, buffer, MAX_PATH);
245 while (nSubProgs && nSubProgs--) {
247 memset(&cplInfo, 0, sizeof(CPLINFO));
248 pCPlApplet(hwndLV, CPL_INQUIRE, nSubProgs, (LPARAM)&cplInfo);
249 if (cplInfo.idName == CPL_DYNAMIC_RES) {
251 NEWCPLINFO cplNewInfo;
252 memset(&cplNewInfo, 0, sizeof(NEWCPLINFO));
253 cplNewInfo.dwSize = sizeof(NEWCPLINFO);
254 pCPlApplet(hwndLV, CPL_NEWINQUIRE, nSubProgs, (LPARAM)&cplNewInfo);
255 cplNewInfo.lData = hCpl;
256 AddEntryToList(hwndLV, &cplNewInfo);
260 NEWCPLINFO cplNewInfo;
261 memset(&cplNewInfo, 0, sizeof(NEWCPLINFO));
262 cplNewInfo.dwSize = sizeof(NEWCPLINFO);
263 if (LoadString(hCpl, cplInfo.idName, cplNewInfo.szName, sizeof(cplNewInfo.szName)/sizeof(TCHAR))) {
265 if (LoadString(hCpl, cplInfo.idInfo, cplNewInfo.szInfo, sizeof(cplNewInfo.szInfo)/sizeof(TCHAR))) {
267 cplNewInfo.hIcon = LoadImage(hCpl, (LPCTSTR)cplInfo.idIcon, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE);
268 cplNewInfo.lData = (LONG)hCpl;
269 AddEntryToList(hwndLV, &cplNewInfo);
274 TRACE(_T("Init of applet has failed\n"));
277 TRACE(_T("Not a valid control panel applet %s\n"), buffer);
281 TRACE(_T("Cannot load control panel applet %s\n"), buffer);
288 static void LoadApplet(HWND hwndLV, LPTSTR buffer, CPlApplet** pListHead)
291 hModule = LoadLibrary(buffer);
293 CPlApplet_Ptr pCPlApplet;
294 pCPlApplet = (CPlApplet_Ptr)(FARPROC)GetProcAddress(hModule, "CPlApplet");
296 if (pCPlApplet(hwndLV, CPL_INIT, 0, 0)) {
298 int nSubProgs = pCPlApplet(hwndLV, CPL_GETCOUNT, 0, 0);
299 if (nSubProgs == 0) {
300 TRACE(_T("No subprogram in applet\n"));
302 if (!(applet = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*applet)))) {
303 goto loadapplet_error;
305 applet->next = *pListHead;
307 _tcsncpy(applet->filename, buffer, MAX_PATH);
308 while (nSubProgs && nSubProgs--) {
309 NEWCPLINFO cplNewInfo;
310 memset(&cplNewInfo, 0, sizeof(NEWCPLINFO));
311 cplNewInfo.dwSize = sizeof(NEWCPLINFO);
312 pCPlApplet(hwndLV, CPL_NEWINQUIRE, nSubProgs, (LPARAM)&cplNewInfo);
313 if (cplNewInfo.hIcon == 0) {
315 memset(&cplInfo, 0, sizeof(CPLINFO));
316 pCPlApplet(hwndLV, CPL_INQUIRE, nSubProgs, (LPARAM)&cplInfo);
317 if (cplInfo.idIcon == 0 || cplInfo.idName == 0) {
318 TRACE(_T("Couldn't get info from sp %u\n"), nSubProgs);
320 TCHAR szName[MAX_CPL_NAME];
321 TCHAR szInfo[MAX_CPL_INFO];
324 if (!(pCPlEntry = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CPlEntry)))) {
325 goto loadapplet_error;
327 pCPlEntry->nSubProg = nSubProgs;
328 pCPlEntry->lData = cplInfo.lData;
329 pCPlEntry->pCPlApplet = applet;
330 hIcon = LoadImage(hModule, (LPCTSTR)cplInfo.idIcon, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE);
331 LoadString(hModule, cplInfo.idName, szName, MAX_CPL_NAME);
332 LoadString(hModule, cplInfo.idInfo, szInfo, MAX_CPL_INFO);
333 if (hIcon) { // add the icon to an image list
334 HIMAGELIST hImageList;
335 hImageList = ListView_GetImageList(hwndLV, LVSIL_NORMAL);
336 pCPlEntry->nIconIndex = ImageList_AddIcon(hImageList, hIcon);
337 hImageList = ListView_GetImageList(hwndLV, LVSIL_SMALL);
338 ImageList_AddIcon(hImageList, hIcon);
341 AddEntryToList(hwndLV, szName, szInfo, pCPlEntry);
344 HIMAGELIST hImageList;
346 TRACE(_T("Using CPL_NEWINQUIRE data\n"));
347 if (!(pCPlEntry = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CPlEntry)))) {
348 goto loadapplet_error;
350 applet->hModule = LoadLibrary(buffer);
351 pCPlEntry->nSubProg = nSubProgs;
352 pCPlEntry->lData = cplNewInfo.lData;
353 pCPlEntry->pCPlApplet = applet;
354 hImageList = ListView_GetImageList(hwndLV, LVSIL_NORMAL);
355 pCPlEntry->nIconIndex = ImageList_AddIcon(hImageList, cplNewInfo.hIcon);
356 hImageList = ListView_GetImageList(hwndLV, LVSIL_SMALL);
357 ImageList_AddIcon(hImageList, cplNewInfo.hIcon);
358 DestroyIcon(cplNewInfo.hIcon);
359 AddEntryToList(hwndLV, NULL, NULL, pCPlEntry);
363 TRACE(_T("Init of applet has failed\n"));
366 TRACE(_T("Not a valid control panel applet %s\n"), buffer);
369 FreeLibrary(hModule);
371 TRACE(_T("Cannot load control panel applet %s\n"), buffer);
376 static BOOL InitListViewItems(HWND hwndLV, LPTSTR szPath)
378 WIN32_FIND_DATA data;
380 TCHAR buffer[MAX_PATH+10], *p;
383 length = _GetSystemDirectory(buffer, sizeof(buffer)/sizeof(TCHAR));
385 lstrcpy(p, _T("\\*.cpl"));
386 memset(&data, 0, sizeof(WIN32_FIND_DATA));
387 hFind = FindFirstFile(buffer, &data);
388 if (hFind != INVALID_HANDLE_VALUE) {
390 if (!(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
393 lstrcpy(p+1, data.cFileName);
394 pApplet = Control_LoadApplet(hwndLV, buffer, &pListHead);
395 if (pApplet != NULL) {
396 AddAppletsToListView(hwndLV, pApplet);
399 lstrcpy(p+1, data.cFileName);
400 LoadApplet(hwndLV, buffer, &pListHead);
403 } while (FindNextFile(hFind, &data));
409 // OnGetDispInfo - processes the LVN_GETDISPINFO notification message.
410 static void OnGetDispInfo(HWND hWnd, NMLVDISPINFO* plvdi)
412 CPlEntry* pCPlEntry = (CPlEntry*)plvdi->item.lParam;
414 plvdi->item.pszText = NULL;
415 plvdi->item.cchTextMax = 0;
416 if (pCPlEntry != NULL) {
417 CPlApplet* pApplet = pCPlEntry->pCPlApplet;
419 if (pApplet->hModule) {
420 CPlApplet_Ptr pCPlApplet;
421 pCPlApplet = (CPlApplet_Ptr)(FARPROC)GetProcAddress(pApplet->hModule, "CPlApplet");
423 static NEWCPLINFO cplNewInfo;
424 memset(&cplNewInfo, 0, sizeof(NEWCPLINFO));
425 cplNewInfo.dwSize = sizeof(NEWCPLINFO);
426 pCPlApplet(hWnd, CPL_NEWINQUIRE, pCPlEntry->nSubProg, (LPARAM)&cplNewInfo);
428 if (plvdi->item.mask && LVIF_IMAGE) {
429 if (cplNewInfo.hIcon) { // add the icon to an image list
430 HIMAGELIST hImageList;
431 hImageList = ListView_GetImageList(hWnd, LVSIL_NORMAL);
432 pCPlEntry->nIconIndex = ImageList_ReplaceIcon(hImageList, pCPlEntry->nIconIndex, cplNewInfo.hIcon);
433 hImageList = ListView_GetImageList(hWnd, LVSIL_SMALL);
434 ImageList_ReplaceIcon(hImageList, pCPlEntry->nIconIndex, cplNewInfo.hIcon);
435 DestroyIcon(cplNewInfo.hIcon);
437 plvdi->item.iImage = pCPlEntry->nIconIndex;
439 if (plvdi->item.mask && LVIF_STATE) {
441 if (plvdi->item.mask && LVIF_TEXT) {
442 switch (plvdi->item.iSubItem) {
444 plvdi->item.pszText = cplNewInfo.szName;
445 plvdi->item.cchTextMax = _tcslen(plvdi->item.pszText);
448 plvdi->item.pszText = cplNewInfo.szInfo;
449 plvdi->item.cchTextMax = _tcslen(plvdi->item.pszText);
452 plvdi->item.pszText = _T("");
453 plvdi->item.cchTextMax = _tcslen(plvdi->item.pszText);
462 static void OnDeleteItem(NMLISTVIEW* pnmlv)
464 CPlEntry* pCPlEntry = (CPlEntry*)pnmlv->lParam;
465 if (pCPlEntry != NULL) {
466 HeapFree(GetProcessHeap(), 0, pCPlEntry);
470 static void OnItemChanged(NMLISTVIEW* pnmlv)
474 void Control_LaunchApplet(HWND hwndLV, CPlEntry* pCPlEntry)
476 CPlApplet_Ptr pCPlApplet;
477 CPlApplet* pApplet = pCPlEntry->pCPlApplet;
480 if (pApplet->hModule == NULL) {
481 pApplet->hModule = LoadLibrary(pApplet->filename);
482 pCPlApplet = (CPlApplet_Ptr)(FARPROC)GetProcAddress(pApplet->hModule, "CPlApplet");
484 if (pCPlApplet(hwndLV, CPL_INIT, 0, 0)) {
485 unsigned int nSubProgs = pCPlApplet(hwndLV, CPL_GETCOUNT, 0, 0);
486 if (nSubProgs < pCPlEntry->nSubProg) {
487 TRACE(_T("Only %u subprograms in applet, requested %u\n"), nSubProgs, pCPlEntry->nSubProg);
491 TRACE(_T("Init of applet has failed\n"));
495 TRACE(_T("Not a valid control panel applet %s\n"), pApplet->filename);
499 if (pApplet->hModule) {
500 pCPlApplet = (CPlApplet_Ptr)(FARPROC)GetProcAddress(pApplet->hModule, "CPlApplet");
502 TCHAR* extraPmts = NULL;
503 if (!pCPlApplet(hwndLV, CPL_STARTWPARMS, pCPlEntry->nSubProg, (LPARAM)extraPmts))
504 pCPlApplet(hwndLV, CPL_DBLCLK, pCPlEntry->nSubProg, pCPlEntry->lData);
508 // NEWCPLINFO* pCPLInfo = &(pCPlEntry->pCPlApplet->info[pCPlEntry->nSubProg]);
509 // TCHAR* extraPmts = NULL;
510 // if (pCPLInfo->dwSize && pApplet->proc) {
511 // if (!pApplet->proc(pApplet->hWnd, CPL_STARTWPARMS, pCPlEntry->nSubProg, (LPARAM)extraPmts))
512 // pApplet->proc(pApplet->hWnd, CPL_DBLCLK, pCPlEntry->nSubProg, pCPLInfo->lData);
516 static void OnDblClick(HWND hWnd, NMITEMACTIVATE* nmitem)
521 switch (nmitem->uKeyFlags) {
522 case LVKF_ALT: // The ALT key is pressed.
524 case LVKF_CONTROL: // The CTRL key is pressed.
526 case LVKF_SHIFT: // The SHIFT key is pressed.
531 info.pt.x = nmitem->ptAction.x;
532 info.pt.y = nmitem->ptAction.y;
533 if (ListView_HitTest(hWnd, &info) != -1) {
535 item.mask = LVIF_PARAM;
536 item.iItem = info.iItem;
537 if (ListView_GetItem(hWnd, &item)) {
538 Control_LaunchApplet(hWnd, (CPlEntry*)item.lParam);
548 static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
550 struct CompareData* pcd = (struct CompareData*)lParamSort;
552 TCHAR buf1[MAX_CPL_INFO];
553 TCHAR buf2[MAX_CPL_INFO];
555 ListView_GetItemText(pcd->hListWnd, lParam1, pcd->nSortColumn, buf1, sizeof(buf1)/sizeof(TCHAR));
556 ListView_GetItemText(pcd->hListWnd, lParam2, pcd->nSortColumn, buf2, sizeof(buf2)/sizeof(TCHAR));
557 return _tcscmp(buf1, buf2);
561 static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
566 ListView_GetItemText((HWND)lParamSort, lParam1, 0, buf1, sizeof(buf1)/sizeof(TCHAR));
567 ListView_GetItemText((HWND)lParamSort, lParam2, 0, buf2, sizeof(buf2)/sizeof(TCHAR));
568 return _tcscmp(buf1, buf2);
571 static void ListViewPopUpMenu(HWND hWnd, POINT pt)
575 BOOL ListView_SortItemsEx(
577 PFNLVCOMPARE pfnCompare,
584 //#define LVM_FIRST 0x1000 // ListView messages
585 #define LVM_SORTITEMSEX (0x1000 + 81)
586 #define ListView_SortItemsEx(hwndLV, _pfnCompare, _lPrm) \
587 (BOOL)SendMessage((hwndLV), LVM_SORTITEMSEX, (WPARAM)(LPARAM)(_lPrm), (LPARAM)(PFNLVCOMPARE)(_pfnCompare))
590 BOOL SortListView(HWND hWnd, int nSortColumn)
592 struct CompareData cd = { hWnd, nSortColumn };
593 return ListView_SortItemsEx(hWnd, CompareFunc, &cd);
596 BOOL ListViewNotifyProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
598 NMITEMACTIVATE* nmitem = (LPNMITEMACTIVATE)lParam;
600 if (nmitem->hdr.idFrom == LIST_WINDOW) {
601 switch (((LPNMHDR)lParam)->code) {
602 case LVN_GETDISPINFO:
603 OnGetDispInfo(hWnd, (NMLVDISPINFO*)lParam);
606 OnDeleteItem((NMLISTVIEW*)lParam);
607 //pnmv = (LPNMLISTVIEW) lParam
609 case LVN_ITEMCHANGED:
610 OnItemChanged((NMLISTVIEW*)lParam);
613 OnDblClick(hWnd, nmitem);
616 //OnRightClick(hWnd, nmitem);
625 VOID DestroyListView(HWND hwndLV)
628 while ((pListHead = Control_UnloadApplet(pListHead)));
631 BOOL RefreshListView(HWND hwndLV, LPTSTR szPath)
633 if (hwndLV != NULL) {
634 ListView_DeleteAllItems(hwndLV);
636 return InitListViewItems(hwndLV, szPath);
639 HWND CreateListView(HWND hwndParent, int id)
644 // Get the dimensions of the parent window's client area, and create the list view control.
645 GetClientRect(hwndParent, &rcClient);
646 hwndLV = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, _T("List View"),
647 WS_VISIBLE | WS_CHILD,
648 0, 0, rcClient.right, rcClient.bottom,
649 hwndParent, (HMENU)id, hInst, NULL);
650 ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_FULLROWSELECT);
651 CreateListColumns(hwndLV);
653 // Initialize the image list, and add items to the control.
654 if (!InitListViewImageLists(hwndLV) || !InitListViewItems(hwndLV, NULL/*szPath*/)) {
655 DestroyWindow(hwndLV);