Progress bar in a Status bar...

This is a discussion on Progress bar in a Status bar... within the Windows Programming forums, part of the Platform Specific Boards category; Is there a way to place the progress bar inside the status bar without using MFC classes, just plain simple ...

  1. #1
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768

    Progress bar in a Status bar...

    Is there a way to place the progress bar inside the status bar without using MFC classes, just plain simple API?

    thank you.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  2. #2
    Dump Truck Internet valis's Avatar
    Join Date
    Jul 2005
    Posts
    357
    CreateStatusBar gives you a window handle, so create a progress bar child window and place it inside one of your parts. I don't know of any specialized api calls to do it.

  3. #3
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    If I'm not mistaken, CreateStatusBar is a part of some sort of class...
    Last edited by Devil Panther; 07-18-2005 at 01:22 PM.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  4. #4
    Dump Truck Internet valis's Avatar
    Join Date
    Jul 2005
    Posts
    357
    oops, meant CreateStatusWindow

  5. #5
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    MSDN: This function is obsolete. Use CreateWindow instead.
    What I use is the next:
    Code:
    int iBarWidths[] = {120, 285, -1};
    static HWND StatusBar, hProgressBar;
    
    /* Creating a Status Bar */
    hStatusBar = CreateWindowEx(NULL, STATUSCLASSNAME, NULL,  WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, 
                                hwnd, (HMENU)IDD_STATUSBAR, hInst, NULL);
    SendMessage(hStatusBar, SB_SETPARTS, 3, (LPARAM) iBarWidths);
    SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM) "some text 1");
    SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) "some text 2");
    
    /* Creating and place the  Progress Bar inside the StatusBar */
    hProgressBar = CreateWindowEx(NULL, "msctls_progress32", NULL, WS_CHILD | WS_VISIBLE, 122,2,163,18,
                                  hStatusBar, (HMENU)IDD_PROGRESS, hInst, NULL);
    SendMessage(hProgressBar, PBM_SETSTEP, (WPARAM)5, 0);
    But is there a simple way to do this, like getting the sub handle of the StatusBar's second part and then create it directly inside there. Or is this the only way.
    Last edited by Devil Panther; 07-18-2005 at 01:25 PM.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  6. #6
    Dump Truck Internet valis's Avatar
    Join Date
    Jul 2005
    Posts
    357
    I assume the parts are windows, though I'm not positive, you will always know where your second part is, so you could try WindowFromPoint to get a handle to it
    Though I'm not sure this would make it easier than just making it a child window and positioning it in your parts
    Last edited by valis; 07-18-2005 at 01:48 PM.

  7. #7
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    But that's exactly what it is right now... a child window of the statusbar control
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  8. #8
    Dump Truck Internet valis's Avatar
    Join Date
    Jul 2005
    Posts
    357
    yup I believe your stuck with that, if you're not already, SB_GETRECT might make it easier

  9. #9
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    SB_GETRECT
    wParam = (WPARAM) iPart;
    lParam = (LPARAM) (LPRECT) lprc;

    Retrieves the bounding rectangle of a part in a status window.

    Returns TRUE if successful, or FALSE otherwise.
    iPart
    Zero-based index of the part whose bounding rectangle is to be retrieved.
    lprc
    Address of a RECT structure that receives the bounding rectangle.
    What can I do with it, does it return a handle or something like that?
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

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. beach bar (sims type game)
    By DrKillPatient in forum Game Programming
    Replies: 1
    Last Post: 03-06-2006, 12:32 PM
  3. Troubles with Sockets
    By cornholio in forum Windows Programming
    Replies: 6
    Last Post: 10-26-2005, 05:31 AM
  4. progress bar newbie
    By WaterNut in forum Windows Programming
    Replies: 18
    Last Post: 08-09-2004, 01:42 PM
  5. Progress Bar in Status Bar :: No MFC
    By Okiesmokie in forum Windows Programming
    Replies: 4
    Last Post: 05-03-2002, 10:51 PM

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