Is there any way to add a string with ID in listbox??
ID shouldn't be visible but it has to be readable again (e.g. on double click).
Thanks for all answers!
Is there any way to add a string with ID in listbox??
ID shouldn't be visible but it has to be readable again (e.g. on double click).
Thanks for all answers!
[C++]
IDE: DevC++ 4.9.9.2 (GCC 3.4.2)
2nd compiler: g++ (GCC 3.4.3/4.0.0)
3rd compiler: Borland 5.5
[C#]
IDE: Microsoft Visual C# Express 2005
2nd IDE: SharpDevelop
2nd compiler: csc in Command Prompt
.NET Framework: 2.0
[PHP]
Core: 5.1.0 beta 3
IDE: PHPEdit
2nd IDE: Notepad
Favourite extensions: exif,gd2,mysql
Favourite PEAR packages: DB, XML_RSS, ID3
Favourite databases: SQLite, MySQL
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
Thanks, but the same thing stopped me when I try to read this ID from listbox. On double click I send message LB_GETITEMDATA, but I don't know how to determine wParam upon the item that was double clicked...
[C++]
IDE: DevC++ 4.9.9.2 (GCC 3.4.2)
2nd compiler: g++ (GCC 3.4.3/4.0.0)
3rd compiler: Borland 5.5
[C#]
IDE: Microsoft Visual C# Express 2005
2nd IDE: SharpDevelop
2nd compiler: csc in Command Prompt
.NET Framework: 2.0
[PHP]
Core: 5.1.0 beta 3
IDE: PHPEdit
2nd IDE: Notepad
Favourite extensions: exif,gd2,mysql
Favourite PEAR packages: DB, XML_RSS, ID3
Favourite databases: SQLite, MySQL
>>how to determine wParam upon the item that was double clicked<<
LB_GETCURSEL.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
OK, everything works, but the problem is, I don't get the value I assigned with LB_SETITEMDATA, but some strange characters...
Code on double click:
PS: It doesn't help if I change types of id and index to int or long int.Code:LRESULT index = SendDlgItemMessage(hwnd, IDLB_UPORABNIKI_PREGLED_SEZNAM, LB_GETCURSEL, 0, 0); if(index == LB_ERR) { MessageBox(hwnd, "Error1!", "Error", MB_OK | MB_ICONERROR); } else { LRESULT id = SendDlgItemMessage(hwnd, IDLB_UPORABNIKI_PREGLED_SEZNAM, LB_GETITEMDATA, (WPARAM)index, 0); if(id == LB_ERR) { MessageBox(hwnd, "Error2!", "Error", MB_OK | MB_ICONERROR); } else { MessageBox(hwnd, (char*)id, "OK", MB_OK); } }
[C++]
IDE: DevC++ 4.9.9.2 (GCC 3.4.2)
2nd compiler: g++ (GCC 3.4.3/4.0.0)
3rd compiler: Borland 5.5
[C#]
IDE: Microsoft Visual C# Express 2005
2nd IDE: SharpDevelop
2nd compiler: csc in Command Prompt
.NET Framework: 2.0
[PHP]
Core: 5.1.0 beta 3
IDE: PHPEdit
2nd IDE: Notepad
Favourite extensions: exif,gd2,mysql
Favourite PEAR packages: DB, XML_RSS, ID3
Favourite databases: SQLite, MySQL
Looks like you're storing and retrieving a pointer to a string (char*) with each listbox item. If that's the case then you'll need to store those strings somewhere else with proper scope otherwise those list item pointers will be invalid and point to garbage - presumably the 'strange characters' you are referring to.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
Thanks - i used array of strings (string not char*) and I made it work!
[C++]
IDE: DevC++ 4.9.9.2 (GCC 3.4.2)
2nd compiler: g++ (GCC 3.4.3/4.0.0)
3rd compiler: Borland 5.5
[C#]
IDE: Microsoft Visual C# Express 2005
2nd IDE: SharpDevelop
2nd compiler: csc in Command Prompt
.NET Framework: 2.0
[PHP]
Core: 5.1.0 beta 3
IDE: PHPEdit
2nd IDE: Notepad
Favourite extensions: exif,gd2,mysql
Favourite PEAR packages: DB, XML_RSS, ID3
Favourite databases: SQLite, MySQL