: Ok, I found the error myself... it was really a stupid thing.
: :
: : SendDlgItemMessage(hDlg, IDC_ANILIST, CB_ADDSTRING, 0, (LPARAM)"X Position");
: : int num = (int)SendDlgItemMessage(hDlg, IDC_ANILIST, CB_GETCOUNT, 0, 0)-1;
: : SendDlgItemMessage(hDlg, IDC_ANILIST, CB_SETITEMDATA, (WPARAM) num, 5);
: :
: : SendDlgItemMessage(hDlg, IDC_ANILIST, CB_SETCURSEL, 0, 0);
: :
: : sel = (int)SendDlgItemMessage(hDlg, IDC_ANILIST, CB_GETITEMDATA, 0, 0);
: : // sel should be 5, but it is 0... I cannot understand why.
: :
: :
: :
: :
How beautiful, if Sorrow had not made sorrow more beautiful than Beauty itself.
: : JOHN KEATS
: :
: :
:
:
:
:
How beautiful, if Sorrow had not made sorrow more beautiful than Beauty itself.
: JOHN KEATS
:
:
:
This will work only on combo-lists which are not sortable, but sortable list items will contain incorrect values. The better way to do it is to use the index returned by CB_ADDSTRING message and use it as WPARAM inside CB_SETITEMDATA. It is also faster, because you do not need the CB_GETCOUNT now. This technique also applies to a list box.