File Loading prob
-
hi guys, i am trying to load the data of a file which is 100MB large in to a List Control. But during the loading Procedure the app does not respond anymore. If i use i a file which is not so large, it works fine. How can i solve the prob ? I am using CStdioFile Best Regards Sonu
-
hi guys, i am trying to load the data of a file which is 100MB large in to a List Control. But during the loading Procedure the app does not respond anymore. If i use i a file which is not so large, it works fine. How can i solve the prob ? I am using CStdioFile Best Regards Sonu
i don't know of any restriction on bytes or items in a list control, but there probably is one, unintended perhaps. do you really want all that stuff in one list? it's not gonna be much use for navigation. if you just want the data available to your app, store it in some other structure (e.g. write a list class) or if you want the user to be able to browse it, perhaps a tree view control (include component MS Forms 2)? hope that is some help.
-
hi guys, i am trying to load the data of a file which is 100MB large in to a List Control. But during the loading Procedure the app does not respond anymore. If i use i a file which is not so large, it works fine. How can i solve the prob ? I am using CStdioFile Best Regards Sonu
To make a different thread and load the file inside this thread. Here is an example: This is the loading thread function:
UINT LoadFileFunc(LPVOID lParam)
{
CListCtrl* pCtrl = (CListCtrl*)lParam;
//open the file here, let's say it is "f" and it is a CStdioFile
CString csLine;
while(f.ReadString(csLine)){
pCtrl->InsertItem(pCtrl->GetItemsCount(), csLine);
}
//close your file
}And below the code from
OnInitDialog()
function (or any other function you want to start loading file)... AfxBeginThread(LoadFileFunc, &m_wndYourListCtrl); ...
Philip Patrick "Two beer or not two beer?" (Shakesbeer) Web-site: www.saintopatrick.com
-
hi guys, i am trying to load the data of a file which is 100MB large in to a List Control. But during the loading Procedure the app does not respond anymore. If i use i a file which is not so large, it works fine. How can i solve the prob ? I am using CStdioFile Best Regards Sonu
The above 2 messages are good suggestions, and definitely things to think about. However, I've also come across this and one reason it took so long for me was because it was sorting on every AddString(). Uncheck the "Sort" box in the properties and see if that improves performance a little. J