473,385 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Progress Control addition to a Dialog Box

Please excuse this elementary question...but I am just dumb....

I have taken a simplistic Dialog Box and added a Progress Control.
When I did that, my Dialog Box was no longer able to intialize using the
DialogBox macro.

If I remove the Progress Control from the form, the form displays
appropriately.

Is there something that needs to be done in addition to providing a callback
function for the dialog?

Here is a brief outline of the code (which is quite simplistic).

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM
lParam)
{
int wmId, wmEvent, rtn_val = 0;
PAINTSTRUCT ps;
HDC hdc;

switch (message)
{
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_about:
rtn_val = (int)DialogBox(hInst, (LPCTSTR)IDD_FORMVIEW, hWnd,
(DLGPROC)Formview);

break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_PAINT:

hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code here...
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}

// Message handler for progress bar form.
LRESULT CALLBACK Formview(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam)
{
switch (message)
{
case WM_INITDIALOG:
return TRUE;

case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
}
return FALSE;
}

The resource (IDD_FORMVIEW) is a simplistic dialog box with a couple of
Static Text fields and a "STOP" Button.

So I am stuck with the following:
1.) How can I get the form to display (i.e. should I ditch the DialogBox
macro?)
2.) How do I dynamically change the progress bar appearance (i.e. how do I
directly call into the form to change the appearance of the bar)?

Any help or shove in the right direction would be appreciated.
Nov 17 '05 #1
1 1634
Nobody is dumb here!

1. Do following in your WinMain function:

int __stdcall WinMain()
{
// ...
INITCOMMONCONTROLSEX ics = {0};
ics.dwICC = ICC_BAR_CLASSES;
ics.dwSize = sizeof(INITCOMMONCONTROLSEX);
// ...
}

Also, add
#include <CommCtrl.h>

to beginning of your source file, and link your application with
comctl32.lib

2. usually, another thread deals with the progress bar update and
dialog itself does not. check progress bar control reference for
further information about messages. but if you really want to learn how
bar works, insert a button into dialog and in your BN_CLICKED handler,
send a PBM_STEPIT or PBM_SETPOS message to progress bar control. in
your WM_INITDIALOG handler, set progress range with PBM_SETRANGE
message before using these messages. if you want to use PBM_STEPIT
message. also, if you consider using PBM_STEPIT, you need to use
PBM_SETSTEP message to set your stepping interval.

Ismail

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: bob | last post by:
Hello, In my appliction I try to pop up a progress dialog box while an analysis is being run: //method progress window public void Run(IWin32Window parent) { Thread analysisThread = new...
4
by: Alexander | last post by:
Hi, I have written a program that takes on some operations much more time than I expected. As I have seen users clicking wildly on the screen to make something happen, I want to follow the...
6
by: Kyle | last post by:
I want to do a single pix update bar instead of the big block that progress bars usually use. I can't seem to find any info on how to do this. Thanks in advance for any help, Kyle
7
by: Pepi Tonas | last post by:
I have a form that takes some time to load because it has to populate some Data. I was trying to display a form on top of it with an activity bar so that user can see that something's going on. ...
2
by: Michael Jervis | last post by:
Hi, I'm writing a little application that scans a large number of media files for processing. The main application currently uses a backgroundworkerprocess to perform the scan. Each media...
5
by: Miro | last post by:
I will try my best to ask this question correctly. I think in the end the code will make more sence of what I am trying to accomplish. I am just not sure of what to search for on the net. I...
15
by: eladla | last post by:
Hi! I am creating a composite control the does some of it`s own data access. I want to display a progress bar between the time the page is loaded and the control place holder is displayed and...
5
by: Johnny Jörgensen | last post by:
Using File.Copy in the System.IO namespace, it's easy to copy one or more files. But I wonder: Is it possible to get windows to display its File Copy Progress dialog at the same time - or...
3
by: Lawyno | last post by:
Hi there :) Here are some infos about my "project": I have the "honor" to write some scripts (VBScript) for some application developed by another company. In this application there is limited...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.