Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hallo Leutz,

VS.Net 7.0.1

ich habe mal wieder ein Problem. In meiner ListCtrl funkt das Sortieren nicht.

Ich bekomme in der CALLBACK Funktion kein LPARAM lParam1 und LPARAM lParam2. Was mach ich falsch??? In der MSDN stehts genau so (fast).

void CMyList::OnLvnColumnclickListdelta(NMHDR *pNMHDR, LRESULT *pResult)

{

NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;

*pResult = 0;

SortInfo.pListCtrl = &m_ctrlListMsiDelta;

SortInfo.iList = pNMListView->iSubItem;

if(SortInfo.bSortDirection == true)

SortInfo.bSortDirection = false;

else

SortInfo.bSortDirection = true;

m_ctrlListMsiDelta.SortItems(CompareDelta, (DWORD)&SortInfo);

for(int i = 0;i < m_ctrlListMsiDelta.GetItemCount(); i++)

{

m_ctrlListMsiDelta.SetItemData(i,i);

}

}

int CALLBACK CompareDelta(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)

{

STRUCKT_SORT_INFO *pSortInfo = reinterpret_cast<STRUCKT_SORT_INFO*>(lParamSort);

//CString test = pSortInfo->pListCtrl->GetItemText(0,0);

CString strItem1 = pSortInfo->pListCtrl->GetItemText(lParam1, pSortInfo->iList);

CString strItem2 = pSortInfo->pListCtrl->GetItemText(lParam2, pSortInfo->iList);

int iResult = 0;

if(pSortInfo->iList == 0)

{

int a = atoi(strItem1);

int b = atoi(strItem2);

if(pSortInfo->bSortDirection == true)

{

if( a < b )

iResult = 1;

else

iResult = -1;

}else

if( a > b )

iResult = 1;

else

iResult = -1;

}

else

{

iResult = strcmp(strItem1, strItem2);

if(pSortInfo->bSortDirection == true)

iResult *= -1;

}

return iResult;

}

Was in der MSDN Library nicht so explizit drin steht, ist, dass in lParam1 und lParam2 nicht die Indices der zu vergleichenden Einträge stehen, sondern die Werte, die den Einträgen mit SetItemData zugewiesen wurden. Wenn du das nie gemacht hast, werden beide Werte immer 0 sein.

THX aber das ist es nicht gewesen. In meiner Class war was anderes Faul.

Danke noch mal.

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.