Thread: Progress bars... HELP!!!

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    31

    Exclamation Progress bars... HELP!!!

    Does anyone know how to integrate Status bars in a program that will show just how much has been saved, as in Microsoft Word or any Microsoft Product?

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    How much do you know about the progress of the save?

    eg are you writting by each record in the file one at a time for a number of records?

    if the dialog containing the progress bar has the HWND hWndPB and the progressbar has ID IDC_PROGRESS then;
    Code:
    //set it back to start
    SendMessage(GetDlgItem(hwndPB,IDC_PROGRESS), PBM_SETPOS, (WPARAM) 0,(LPARAM)0);
    //set the range
    TotalSteps=100;
    SendMessage(GetDlgItem(hwndPB,IDC_PROGRESS), PBM_SETRANGE, (WPARAM) 0,(LPARAM)MAKELPARAM(0,TotalSteps));	
    //set each step to one
    SendMessage(GetDlgItem(hwndPB,IDC_PROGRESS), PBM_SETSTEP, (WPARAM) 1, 0);
    //this will step it once
    SendMessage(GetDlgItem(hwndPB ,IDC_PROGRESS ), PBM_STEPIT, (WPARAM) 0, 0);
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    31
    sorry for the delay of my answer. I know this much, when a program saves, it loads a progress bar, and when it is just about finished, the progress bar is just about to the end. What I would like to do, is have a progress bar define for the user approximately how much time is left for the file to be sent via TCP/IP to another computer while being saved and printed at two different other computers. If you could please help, I would appreciate it.

    ~Brett Patterson
    "Some succeed because they are destined to, others succeed because they are determined to."
    ~Anonymous

    "A shorn scrotum is quite breathtaking, I suggest you try it."
    ~Dr. Evil

    EMT/Firefighter
    Eagle Scout

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    So you are sending a file thru a socket?
    You can get the file size if you have a HANDLE to it with GetFileSize(). As it is written to the socket in smallish amounts, depending on the buffer size you have set in setsockopt(). Each write can be timed using GetTickCount() and so by percentage the total time calculated.
    Use the above lines to set the progressbar steps and create a static ctrl to display the time, remember to UpdateWindow() after changing the text to display the new text on screen.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    Registered User
    Join Date
    Jan 2002
    Posts
    31
    Thanks for all of your help. I'll try that soon and will be back to inform you of my success. Hopefully all goes well. It could be a while because I have actually lost my entire program. My computer was in a fire, so if you would please bear with me as I try and regain what I have lost over the next few weeks. Thanks a lot though. Just in case you are wondering, I have a desktop and a laptop, my laptop is what is gone.

    ~Prog.Patterson
    "Some succeed because they are destined to, others succeed because they are determined to."
    ~Anonymous

    "A shorn scrotum is quite breathtaking, I suggest you try it."
    ~Dr. Evil

    EMT/Firefighter
    Eagle Scout

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Creating a progress window
    By Xzyx987X in forum Windows Programming
    Replies: 6
    Last Post: 10-06-2004, 04:02 PM
  2. Progress bars in XP
    By Hunter2 in forum Windows Programming
    Replies: 2
    Last Post: 09-27-2003, 11:47 AM
  3. Changing progress bars in win32....
    By jverkoey in forum Windows Programming
    Replies: 6
    Last Post: 04-27-2003, 03:32 AM
  4. progress bars with Win32 API
    By bennyandthejets in forum C++ Programming
    Replies: 15
    Last Post: 09-10-2002, 04:25 AM
  5. Progress Bars
    By knight543 in forum Windows Programming
    Replies: 1
    Last Post: 08-21-2002, 10:45 AM