Windows programming

Moderators: None (Apply to moderate this forum)
Number of threads: 3711
Number of posts: 9173

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Re: Combo-box data... what am I missing ??? Posted by AsmGuru62 on 17 Nov 2003 at 7:30 AM
: 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.
Thread Tree
chick80 Combo-box data... what am I missing ??? on 16 Nov 2003 at 4:48 AM
pingpong Re: Combo-box data... what am I missing ??? on 16 Nov 2003 at 5:44 AM
chick80 Re: Combo-box data... what am I missing ??? on 16 Nov 2003 at 6:08 AM
chick80 Re: Combo-box data... what am I missing ??? on 16 Nov 2003 at 6:23 AM
AsmGuru62 Re: Combo-box data... what am I missing ??? on 17 Nov 2003 at 7:30 AM



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.