Using progress bar control

This is a discussion on Using progress bar control within the Windows Programming forums, part of the Platform Specific Boards category; Hi, I'm trying to use a progress bar control in my application. I'm following this example at msn site http://msdn.microsoft.com/library/?u...divcontrol.asp ...

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    6

    Using progress bar control

    Hi, I'm trying to use a progress bar control in my application. I'm following this example at msn site http://msdn.microsoft.com/library/?u...divcontrol.asp.

    I'm using this code to create the control:
    Code:
        InitCommonControlsEx(&myInitCtrls);
        hwndProgressBar = CreateWindowEx(
                 0, 
                 progressBarClassName,
    	         NULL, 
                 WS_CHILD | WS_VISIBLE,
                 0, 
                 0,
                 200, 
                 10, 
                 hwndParent, 
                 0, 
                 hInstance, 
                 NULL);
    Before, I've initialized
    Code:
    INITCOMMONCONTROLSEX myInitCtrls;
    and included
    Code:
    #include <commctrl.h>
    The problem is that compiler throws this error:
    Code:
    "31 progressbar.c [Warning] data definition has no type or storage class"
    I've checked comctl32.dll version 4.70 or later is my Windows System Directory.

  2. #2
    Registered User KonArtis's Avatar
    Join Date
    Mar 2003
    Posts
    34
    Code:
    HWND CreateProgress(HWND hParent, int cx, int cy, int x, int y, DWORD dwStyle, DWORD dwExStyle)
    {
    	INITCOMMONCONTROLSEX icex;
    	icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
    	icex.dwICC  = ICC_PROGRESS_CLASS;
    	InitCommonControlsEx(&icex);
    	
    	hwnd=CreateWindowEx(dwExStyle, PROGRESS_CLASS, NULL, 
    			dwStyle | WS_CHILD | WS_VISIBLE, x, y, cx, cy, hParent, NULL, 0, NULL);
    }
    Also make sure when you compile you include comctl32.lib in the library modules. If your using vc++ you can get to it by pressing Alt+F7.

    If you need more info about any of the control go here Windows Controls

    Hope this helps

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Updating a progress bar
    By NewGuy100 in forum C++ Programming
    Replies: 2
    Last Post: 03-13-2006, 12:00 PM
  2. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 05:23 AM
  3. beach bar (sims type game)
    By DrKillPatient in forum Game Programming
    Replies: 1
    Last Post: 03-06-2006, 12:32 PM
  4. progress bar newbie
    By WaterNut in forum Windows Programming
    Replies: 18
    Last Post: 08-09-2004, 01:42 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM

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