Solved

Dialog status bar from a .rc file

Posted on 2007-04-06
6
948 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
  • 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
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone 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
move a line in eclipse 3 107
has22 challenge 11 105
Making an alias 7 101
moto 4g phone enable finger print 4 27
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

828 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