Adding progress bar to a dialog box.

This is a discussion on Adding progress bar to a dialog box. within the Windows Programming forums, part of the Platform Specific Boards category; How would I go about adding a progress bar to my dialog box?(I'm using Dev-C++ 4.9.6.8). The dialog box design ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220

    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++ 4.9.6.8).

    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
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    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:
    Code:
    CONTROL IDC_PROGBAR, PROGRESS_CLASS, 0, 0, 400, 200, WS_CHILD|WS_VISIBLE
    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:

    http://www.cprogramming.com/cboard/s...ht=progressbar

    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, 01:58 PM
  4. New Theme
    By XSquared in forum A Brief History of Cprogramming.com
    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, 10:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21