Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. File Loading prob

File Loading prob

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sonu Kapoor
    wrote on last edited by
    #1

    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

    P L J 3 Replies Last reply
    0
    • S Sonu Kapoor

      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

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • S Sonu Kapoor

        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

        P Offline
        P Offline
        Philip Patrick
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • S Sonu Kapoor

          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

          J Offline
          J Offline
          Jamie Hale
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups