acerola
asked on
Dialog status bar from a .rc file
First of all I am using the API not MFC, but since there is no API section, my question goes here.
I want to create a status bar on a dialog window. If I do:
CreateWindowEx(0, "msctls_statusbar32", NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwnd_main, NULL, GetModuleHandle(NULL), NULL);
It works fine. But I want to create it in the resource file (.rc). I try (inside the DIALOG definition):
CONTROL "", IDC_STATUSBAR, "msctls_statusbar32", WS_CHILD | WS_VISIBLE, 0, 0, 0, 0
It compiles fine but no status bar appear. Any Ideas?
I want to create a status bar on a dialog window. If I do:
CreateWindowEx(0, "msctls_statusbar32", NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwnd_main, NULL, GetModuleHandle(NULL), NULL);
It works fine. But I want to create it in the resource file (.rc). I try (inside the DIALOG definition):
CONTROL "", IDC_STATUSBAR, "msctls_statusbar32", WS_CHILD | WS_VISIBLE, 0, 0, 0, 0
It compiles fine but no status bar appear. Any Ideas?
ASKER
Same thing. It compiles ok, but no status bar appear on the window.
Have you done the InitCommonControlsEx call in your app's WinMain ?
ASKER
I found the problem: when I call SetMenu, it pushes all controls down to insert the menu, and the status bar is pushed outside the dialog. If I take out the SetMenu, the status bar appears fine. When I create the status bar using CreateWindowEx, the status bar is created after the menu is inserted, so the problem doesn't happen.
This is the cause of the problem, but I still have no solution.
This is the cause of the problem, but I still have no solution.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
MENU IDC_SDKTEST
Yes, that works. I was doing:
SetMenu(hwnd_main, LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MAINME NU)));
And SetMenu would push the status bar outside.
Thanks for the help.
Yes, that works. I was doing:
SetMenu(hwnd_main, LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MAINME
And SetMenu would push the status bar outside.
Thanks for the help.
CONTROL "",IDC_STATUSBAR,"msctls_s