CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: ProgressBar

  1. #1
    Join Date
    Jul 2006
    Posts
    285

    ProgressBar

    Ηι
    I want to see progress in something in my project by Using ProgressBar!!!!!
    So Max will be 100 Min 0 and Step 1...
    Can anyone give me any idea codes?????

  2. #2
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: ProgressBar

    You can place a progress bar control on your dialog box, and assign it a member variable using classwizard, and simply use it in code.

    Here are few tutorials,

    http://www.functionx.com/visualc/app...odymonitor.htm

    http://www.codersource.net/mfc_cprogressctrl.html

    http://www.softlookup.com/tutorial/vc++/vcu22fi.asp
    Regards,
    Ramkrishna Pawar

  3. #3
    Join Date
    Sep 2004
    Location
    Italy
    Posts
    389

    Re: ProgressBar

    The default range for the progress bar is already 0,100 (min,max). If you still want to change it, use PBM_SETRANGE or PBM_SETRANGE32.
    To set the step, use PBM_SETSTEP.
    To increment the progress with a step, use PBM_STEPIT.

  4. #4
    Join Date
    Oct 2005
    Location
    Bangalore
    Posts
    1,051

    Re: ProgressBar

    I liked this Article .....it has the progressbar as a tooltip style. You can have a look , as it mayby a bit too complex for you in this stage as the Author has implemented using System wide hooks and so on. Anyway checkit out,
    A progressbar control that follows the mouse cursor using a system wide hook
    - Sreehari
    "Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us."
    " Everybody is sent to Earth on a purpose. I am so Lagging behind that i won't die." – Calvin

  5. #5
    Join Date
    Dec 2006
    Location
    Bangalore
    Posts
    76

    Resolved Re: ProgressBar

    Try this PB Demo


    HWND hwndProgress = GetDlgItem(hwnd, IDC_PROGRESS);
    for(int nPos = 0; nPos <= 100; nPos++)
    {
    SendMessage(hwndProgress, PBM_SETPOS, (WPARAM)nPos, 0);
    Sleep(50);
    }

  6. #6
    Join Date
    Dec 2011
    Location
    Bucharest, Romania
    Posts
    29

    Re: ProgressBar

    Hello codeguru.com,

    I want to remind you have to *link* "comctl32.lib", so you can use the functions regarding progress bars.
    Also don't forget to *include* the commoncontrols in your app by adding #include "commctrl.h".
    Once the suspects are linked and included you need to do the initialization, by calling InitCommonControls().

    After applying these additional steps, you get an awaiting progress bar in your app.

  7. #7
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,825

    Re: ProgressBar

    A reply after 12 years.....
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured