How can I Refresh List Box in a loop adding item
-
I m trying to refresh ListBox when i m adding Items in a for loop. List box freshed after comliting loop. My code is here for(int i=1;i<=100;i+=1) //Loop { if(i%10==0) { SendDlgItemMessage(IDC_LIST3, LB_INSERTSTRING, (WPARAM) -1, (LPARAM) _T("HP Laser Jet 5000 Series PCL 6")); //Adding String in ListBox } } :doh: Repply Please
Pankaj Jain
-
I m trying to refresh ListBox when i m adding Items in a for loop. List box freshed after comliting loop. My code is here for(int i=1;i<=100;i+=1) //Loop { if(i%10==0) { SendDlgItemMessage(IDC_LIST3, LB_INSERTSTRING, (WPARAM) -1, (LPARAM) _T("HP Laser Jet 5000 Series PCL 6")); //Adding String in ListBox } } :doh: Repply Please
Pankaj Jain
Why you want costly refreshing in this case? Any way it will not take much time to complete the loop. You can consider using
WM_SETREDRAW
for refreshing list box. You should ask such question in VC++[^] forum. As there is nothing specific toCLI
in this question.Prasad Notifier using ATL | Operator new[],delete[][^]
-
Why you want costly refreshing in this case? Any way it will not take much time to complete the loop. You can consider using
WM_SETREDRAW
for refreshing list box. You should ask such question in VC++[^] forum. As there is nothing specific toCLI
in this question.Prasad Notifier using ATL | Operator new[],delete[][^]
Thanks Prasad! for ur reply, but there is no effect after modifying my code for(int i=1;i<=100;i+=1) //Loop { if(i%10==0) { SendDlgItemMessage(IDC_LIST3, LB_INSERTSTRING, (WPARAM) -1, (LPARAM) _T("HP Laser Jet 5000 Series PCL 6")); //Adding String in ListBox SendDlgItemMessage(IDC_LIST3, WM_SETREDRAW , 1, 1);//Code is added here } } Acually i want to add in listbox with the progresbar so I need to refresh listbox to show simulteneous progress, If u hv any other idea please share with me. I will take care about ur suggession in future. Thanks
Pankaj Jain
-
Thanks Prasad! for ur reply, but there is no effect after modifying my code for(int i=1;i<=100;i+=1) //Loop { if(i%10==0) { SendDlgItemMessage(IDC_LIST3, LB_INSERTSTRING, (WPARAM) -1, (LPARAM) _T("HP Laser Jet 5000 Series PCL 6")); //Adding String in ListBox SendDlgItemMessage(IDC_LIST3, WM_SETREDRAW , 1, 1);//Code is added here } } Acually i want to add in listbox with the progresbar so I need to refresh listbox to show simulteneous progress, If u hv any other idea please share with me. I will take care about ur suggession in future. Thanks
Pankaj Jain
PK Jain wrote:
Acually i want to add in listbox with the progresbar so I need to refresh listbox to show simulteneous progress
Consider using thread for this. You can get lot of example related to this on CP.
Prasad Notifier using ATL | Operator new[],delete[][^]