Thread: Adding progress bar to a dialog box.

  1. #1
    Registered User
    Join Date
    Jan 2002

    Adding progress bar to a dialog box.

    How would I go about adding a progress bar to my dialog box?(I'm using Dev-C++

    The dialog box design is entirely in the resource editor and it is all set up to look okay. How do I add a progress bar, change it's progress, etc?

    Thanks in advance.

  2. #2
    Join Date
    Jan 2002
    You can create the progress bar in your WM_INITDIALOG handler for your dialog using CreateWindowEx, an example of which can be found on [shameless plug]my wee humble website[/shameless plug].

    If you want to create the control as part of your dialog resource script then use the CONTROL resource definition statement to define it; you will still have to load in the COMCTL32.DLL with InitCommonControlsEx in your WM_INITDIALOG handler (for example) in order for it to work. Something like (within the definition of your dialogbox resource), where IDC_PROGBAR is the short int id of your progressbar:
    or generally:

    CONTROL text, id, class, style, x, y, width, height, extended style

    You should check on msdn for the exact syntax as this is from memory.

    In any event, when using the MinGW compiler you should, in any program using common controls, #define _WIN32_IE 0x0400.

    For an example of how to use your created progressbar, here's one of Novacain's excellent and succint explanations:

    Hope that helps.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 02-13-2008, 02:59 PM
  2. beach bar (sims type game)
    By DrKillPatient in forum Game Programming
    Replies: 1
    Last Post: 03-06-2006, 01:32 PM
  3. Progress bar in a Dialog Box
    By osal in forum Windows Programming
    Replies: 3
    Last Post: 07-15-2004, 12:58 PM
  4. New Theme
    By XSquared in forum A Brief History of
    Replies: 160
    Last Post: 04-01-2004, 08:00 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM