Thread: Need help for developing an application

  1. #1
    Registered User Afrinux's Avatar
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    46

    Post Need help for developing an application

    Hi all!
    Here is the overview of the application I am trying to develop:
    Platform: Windows XP, Visual C++ 6
    Application type: MFC
    Features: Read a file sector by sector ( 2048 bytes) and display it in a tree view.

    Here are the problems I am facing:
    1. If I try to read a file which size is bigger than 1 GB, the program uses 100% of the CPU memory and then crashes

    2. When the program is reading a file, I want to display a Progress Bar in a new dialog. Using CDialog->DoModal, the dialog does pop up, but the progress bar doesnt work.

    Possible problem: When reading a file, I use a loop. Maybe the program stays in that loop too long leading it to crash.
    Any ideas, how I should make this work.
    First I want to keep the loop for reading a file, makes the program exit the loop anytimes a window message comes, and then resume the loop.
    Thanks in advance!
    Afrinux

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    Any ideas, how I should make this work.
    Ask your questions in the Windows programming forum?

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    >> Read a file sector by sector ( 2048 bytes) and display it in a tree view.

    display *what* in the treeview - the entire file, statistics, analytic information?

    >> If I try to read a file which size is bigger than 1 GB, the program uses 100% of the CPU memory and then crashes

    chances are you won't be able to request that much memory using standard calls (new, malloc) - Windows has a function VirtualAlloc that may be helpful to you.

    >> When the program is reading a file, I want to display a Progress Bar in a new dialog. Using CDialog->DoModal, the dialog does pop up, but the progress bar doesnt work.

    try getting it to work on it's own first before incorporating it into your program - makes debugging that much easier.

    >> Maybe the program stays in that loop too long leading it to crash.

    why would you think that a loop could crash a program (by itself)? a better guess might be stack overflow due to recursive or large stack-framed functions being used inside the loop.

    by the way, we have a Windows forum here that would probably be a better place for this thread.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  4. #4
    Registered User Afrinux's Avatar
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    46
    Hi Sebastiani and 7stud.
    Thanks for your replies. I will post it in the windows sections.
    And Sebastiani, I will make comments about your reply there.
    Thanks for your time.
    Afrinux

  5. #5
    Registered User Afrinux's Avatar
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    46
    I have moved the topic here:
    http://cboard.cprogramming.com/showthread.php?t=76477
    Moderator: Would you please lock this thread. Thanks in advance.
    Afrinux

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Cleanup of the application...
    By Petike in forum Windows Programming
    Replies: 1
    Last Post: 08-16-2008, 05:23 PM
  2. Problem with com application
    By amardon in forum C++ Programming
    Replies: 3
    Last Post: 10-06-2005, 05:50 AM
  3. MFC run application by clicking on file...
    By dug in forum Windows Programming
    Replies: 4
    Last Post: 12-02-2004, 04:33 AM
  4. Win application not very portable
    By swed in forum Windows Programming
    Replies: 5
    Last Post: 10-01-2001, 11:17 AM