Does anyone have any idea how to add a status bar to a dialog box in an .rc file? If so, can you show me an example. thanks!
Does anyone have any idea how to add a status bar to a dialog box in an .rc file? If so, can you show me an example. thanks!
Right click on the dialog and choose "Insert Active-X control". Choose "Microsoft Statusbar" from the list.
If you're not using a dialog editor:
Code:CONTROL "", IDD_STATUS_BAR, STATUSCLASSNAME, WS_CHILD | WS_VISIBLE, 7, 63, 190, 8
thanks, i just got it. Im trying to add a progress bar to the status bar, but I cant find any examples on how to do that. When I try to put the progress bar on it by the coordinates, the progress bar just seems to be overlapped by the status bar. I cant find any examples however on how to do what im trying to do. I put a search on cprogramming.com and a few came up but they werent for c/c++ win32 programming. And i searched the net, but i couldnt find anything.
You'll will have to make the progress bar a child of the status bar. You will also have to size the progress bar appropriately.
Code:// Sample: Make IDD_STATUS the parent of IDD_PROGRESS SetParent(GetDlgItem(IDD_PROGRESS), GetDlgItem(IDD_STATUS));Code:// Sample: Size IDD_PROGRESS to fit in the status bar GetClientRect(GetDlgItem(IDD_STATUS), &rect); MoveWindow(GetDlgItem(IDD_PROGRESS), rect.left, rect.top, rect.right, rect.bottom, TRUE);
Hey, i tried doing that, but my progress bar disappeared. it doenst seem to work.
It should. Have you used MoveWindow as described by 'tmouse to reposition the control?
[edit]>>but my progress bar disappeared<<
It's more likely your statusbar has just been obscured by the progressbar. Try:when repositioning the progress bar - it should show up as a thin strip on the left of the status bar.[/edit]Code:MoveWindow(GetDlgItem(IDD_PROGRESS),0,0,30,8,1);
Last edited by Ken Fitlike; 07-25-2004 at 05:51 AM.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
still didnt work, heres the code ive done.
Code:in rc file CONTROL "", ID_PROGRESS, PROGRESS_CLASS,WS_VISIBLE , 55, 150, 100, 30 CONTROL " ",ID_STATUS_SEARCH,STATUSCLASSNAME, WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP, 0, 0,0, 0 in c file SetParent(GetDlgItem(hwnd,ID_PROGRESS), GetDlgItem(hwnd,ID_STATUS_SEARCH)); GetClientRect(GetDlgItem(hwnd,ID_STATUS_SEARCH), &rect); MoveWindow(GetDlgItem(hwnd,ID_PROGRESS), 0,0,30,8, TRUE);
did that, still doesnt show up
i thihnk it has something to do with this:
because when i take it out i can see the bar, but its not on the status bar, but when i put that in i dont see it anymoreCode:SetParent(GetDlgItem(hwnd,ID_PROGRESS), GetDlgItem(hwnd,ID_STATUS_SEARCH));
I checked the MSDN website, and it said i needed to use these two macros if im using windows xp,
WM_CHANGEUISTATE and WM_UPDATEUISTATE.
however, I tried compiling it and it said those were undeclared identifiers
I never would have figured out this one without a few minutes of debugging.
See the problem here? Hint: why would the call to GetDlgItem be failing in MoveWindow? Have a think about it, especially the arguments that GetDlgItem takes, before reading on. Try to figure it out.Code:SetParent(GetDlgItem(hwnd,ID_PROGRESS), GetDlgItem(hwnd,ID_STATUS_SEARCH)); MoveWindow(GetDlgItem(hwnd,ID_PROGRESS), 0,0,30,8, TRUE);
The rest of this message, if needed, will be posted tomorrow!
[edit]I don't think WM_CHANGEUISTATE and WM_UPDATEUISTATE are needed here, although good work in looking them up. It's all about the arguments to GetDlgItem().[/edit]
Last edited by anonytmouse; 07-25-2004 at 11:15 AM.
hehe thanks, im suppose to turn this in tomorrow though. hehe ill try to figure it out though, thanks!
Well MoveWindow moves a window but GetDlgItem takes in a window and a dialog item, so i dont know where to go from there other than the progress bar in the dialog box is just an item and not a window? i dont know if what im saying makes sense since im new to this stuff.