Solved

Dialog status bar from a .rc file

Posted on 2007-04-06
6
953 Views
Last Modified: 2013-11-20
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?
0
Comment
Question by:acerola
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 9

Expert Comment

by:Priyesh
ID: 18870206
Try this -
    CONTROL         "",IDC_STATUSBAR,"msctls_statusbar32",CCS_BOTTOM,11,52,147,30

0
 
LVL 1

Author Comment

by:acerola
ID: 18870259
Same thing. It compiles ok, but no status bar appear on the window.
0
 
LVL 9

Expert Comment

by:Priyesh
ID: 18870311
Have you done the InitCommonControlsEx call in your app's WinMain ?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:acerola
ID: 18870347
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.
0
 
LVL 9

Accepted Solution

by:
Priyesh earned 50 total points
ID: 18870462
I am trying this in Visual C++ 6.0, SDK app. Works fine for me even after i added the menu. What version of visual studio are you trying this in?

Here is my dialog resource -

IDD_ABOUTBOX DIALOG DISCARDABLE  22, 17, 230, 75
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "About"
MENU IDC_SDKTEST
FONT 8, "System"
BEGIN
    ICON            IDI_SDKTEST,IDC_MYICON,14,9,20,20
    LTEXT           "SDKTest Version 1.0",IDC_STATIC,49,10,119,8,SS_NOPREFIX
    LTEXT           "Copyright (C) 2007",IDC_STATIC,49,20,119,8
    DEFPUSHBUTTON   "OK",IDOK,195,6,30,11,WS_GROUP
    CONTROL         "",IDC_STATUSBAR,"msctls_statusbar32",0x3,0,59,230,16
END
0
 
LVL 1

Author Comment

by:acerola
ID: 18870488
MENU IDC_SDKTEST

Yes, that works. I was doing:

SetMenu(hwnd_main, LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MAINMENU)));

And SetMenu would push the status bar outside.

Thanks for the help.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Tab names are off by one 5 54
dog bark java program 15 132
wordmultiple challenge 12 170
Problem to open Excel file 15 266
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question