Multiple Messages without an OK Button 
Author Message
 Multiple Messages without an OK Button

Hello,

In a Win32 dialog-based MFC VC++ 6 program (not a console program), I'm
trying to
provide feedback to the user about which files I am processing.  I don't
want the user to have to hit "OK" on a MessageBox().  I just want the file
names to "zoom" through in some sort of message box, kind of like when you
install software and you get "Checking System Requirements...", then
"Installing program files...", then "Updating Registry...", etc. without a
need for the user to hit an OK Button.

Can someone help me out with this...I'm well versed in C and console-like
programming, where I would just use printf() to provide feedback.  All I can
find for messages in Visual C++ is MessageBox() or AfxMessageBox().  Each of
these always puts an OK Button on the message, which isn't what I need.
Any help is deeply appreciated.  Thanks!



Wed, 02 Jul 2003 14:12:48 GMT  
 Multiple Messages without an OK Button
Add a static control (sometimes called a label) to your dialog. Change the
resource ID of this control from its default of IDC_STATIC to something
unique, maybe IDC_STATUS. Then to update it from your program use a call
something like...

SetDlgItemText(IDC_STATUS, "Text you wish to display");

Of course the text to be displayed can be contaned in a null-terminated
string or a CString object.

Dave Smith


Quote:
> Hello,

> In a Win32 dialog-based MFC VC++ 6 program (not a console program), I'm
> trying to
> provide feedback to the user about which files I am processing.  I don't
> want the user to have to hit "OK" on a MessageBox().  I just want the file
> names to "zoom" through in some sort of message box, kind of like when you
> install software and you get "Checking System Requirements...", then
> "Installing program files...", then "Updating Registry...", etc. without a
> need for the user to hit an OK Button.

> Can someone help me out with this...I'm well versed in C and console-like
> programming, where I would just use printf() to provide feedback.  All I
can
> find for messages in Visual C++ is MessageBox() or AfxMessageBox().  Each
of
> these always puts an OK Button on the message, which isn't what I need.
> Any help is deeply appreciated.  Thanks!



Wed, 02 Jul 2003 14:58:12 GMT  
 Multiple Messages without an OK Button
Hi,

Or, add a static control, never mind the ID, attach a CString variable to
it, m_sLabel, say, and every time you change its value, call
UpdateData(FALSE).

Cheers


Quote:
> Hello,

> In a Win32 dialog-based MFC VC++ 6 program (not a console program), I'm
> trying to
> provide feedback to the user about which files I am processing.  I don't
> want the user to have to hit "OK" on a MessageBox().  I just want the file
> names to "zoom" through in some sort of message box, kind of like when you
> install software and you get "Checking System Requirements...", then
> "Installing program files...", then "Updating Registry...", etc. without a
> need for the user to hit an OK Button.

> Can someone help me out with this...I'm well versed in C and console-like
> programming, where I would just use printf() to provide feedback.  All I
can
> find for messages in Visual C++ is MessageBox() or AfxMessageBox().  Each
of
> these always puts an OK Button on the message, which isn't what I need.
> Any help is deeply appreciated.  Thanks!



Wed, 02 Jul 2003 23:47:21 GMT  
 Multiple Messages without an OK Button
I don't mean to be argumentative; however, if you add a static control
without changing it ID, then it will not show up in ClassWizard. ClassWizard
ignores any control whose ID is IDC_STATIC.

UpdateData(FALSE) will work as well. This updates all controls on the
dialog, however.

Dave Smith


Quote:
> Hi,

> Or, add a static control, never mind the ID, attach a CString variable to
> it, m_sLabel, say, and every time you change its value, call
> UpdateData(FALSE).

> Cheers



> > Hello,

> > In a Win32 dialog-based MFC VC++ 6 program (not a console program), I'm
> > trying to
> > provide feedback to the user about which files I am processing.  I don't
> > want the user to have to hit "OK" on a MessageBox().  I just want the
file
> > names to "zoom" through in some sort of message box, kind of like when
you
> > install software and you get "Checking System Requirements...", then
> > "Installing program files...", then "Updating Registry...", etc. without
a
> > need for the user to hit an OK Button.

> > Can someone help me out with this...I'm well versed in C and
console-like
> > programming, where I would just use printf() to provide feedback.  All I
> can
> > find for messages in Visual C++ is MessageBox() or AfxMessageBox().
Each
> of
> > these always puts an OK Button on the message, which isn't what I need.
> > Any help is deeply appreciated.  Thanks!



Thu, 03 Jul 2003 03:56:58 GMT  
 Multiple Messages without an OK Button
I think that one thing that might be important is to use a modeless dialog.
If so, then some help with that is at:

http://www.cpp.atfreeweb.com/ModelessDialogs.html


Quote:
> Hello,

> In a Win32 dialog-based MFC VC++ 6 program (not a console program), I'm
> trying to
> provide feedback to the user about which files I am processing.  I don't
> want the user to have to hit "OK" on a MessageBox().  I just want the file
> names to "zoom" through in some sort of message box, kind of like when you
> install software and you get "Checking System Requirements...", then
> "Installing program files...", then "Updating Registry...", etc. without a
> need for the user to hit an OK Button.

> Can someone help me out with this...I'm well versed in C and console-like
> programming, where I would just use printf() to provide feedback.  All I
can
> find for messages in Visual C++ is MessageBox() or AfxMessageBox().  Each
of
> these always puts an OK Button on the message, which isn't what I need.
> Any help is deeply appreciated.  Thanks!



Thu, 03 Jul 2003 05:25:36 GMT  
 Multiple Messages without an OK Button
That's true, sorry, if my note sounded offensive.

Cheers.


Quote:
> I don't mean to be argumentative; however, if you add a static control
> without changing it ID, then it will not show up in ClassWizard.
ClassWizard
> ignores any control whose ID is IDC_STATIC.

> UpdateData(FALSE) will work as well. This updates all controls on the
> dialog, however.

> Dave Smith



> > Hi,

> > Or, add a static control, never mind the ID, attach a CString variable
to
> > it, m_sLabel, say, and every time you change its value, call
> > UpdateData(FALSE).

> > Cheers



> > > Hello,

> > > In a Win32 dialog-based MFC VC++ 6 program (not a console program),
I'm
> > > trying to
> > > provide feedback to the user about which files I am processing.  I
don't
> > > want the user to have to hit "OK" on a MessageBox().  I just want the
> file
> > > names to "zoom" through in some sort of message box, kind of like when
> you
> > > install software and you get "Checking System Requirements...", then
> > > "Installing program files...", then "Updating Registry...", etc.
without
> a
> > > need for the user to hit an OK Button.

> > > Can someone help me out with this...I'm well versed in C and
> console-like
> > > programming, where I would just use printf() to provide feedback.  All
I
> > can
> > > find for messages in Visual C++ is MessageBox() or AfxMessageBox().
> Each
> > of
> > > these always puts an OK Button on the message, which isn't what I
need.
> > > Any help is deeply appreciated.  Thanks!



Thu, 03 Jul 2003 07:19:09 GMT  
 Multiple Messages without an OK Button
I don't think UpdateData is the best method to update controls, see my
essay on Avoiding UpdateData on my MVP Tips site.
                                joe

Quote:

>Hi,

>Or, add a static control, never mind the ID, attach a CString variable to
>it, m_sLabel, say, and every time you change its value, call
>UpdateData(FALSE).

>Cheers



>> Hello,

>> In a Win32 dialog-based MFC VC++ 6 program (not a console program), I'm
>> trying to
>> provide feedback to the user about which files I am processing.  I don't
>> want the user to have to hit "OK" on a MessageBox().  I just want the file
>> names to "zoom" through in some sort of message box, kind of like when you
>> install software and you get "Checking System Requirements...", then
>> "Installing program files...", then "Updating Registry...", etc. without a
>> need for the user to hit an OK Button.

>> Can someone help me out with this...I'm well versed in C and console-like
>> programming, where I would just use printf() to provide feedback.  All I
>can
>> find for messages in Visual C++ is MessageBox() or AfxMessageBox().  Each
>of
>> these always puts an OK Button on the message, which isn't what I need.
>> Any help is deeply appreciated.  Thanks!

Joseph M. Newcomer [MVP]

Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm


Fri, 04 Jul 2003 04:44:32 GMT  
 Multiple Messages without an OK Button
You can take several approaches. Perhaps the simplest one is to create
a modeless dialog (for example a modeless dialog with no system menu,
close menu, etc., and which contains just a single static control).
Create the control as described, changed its ID from IDC_STATIC to
something like IDC_STATUS, create a member variable for it (see my
essay on Avoiding GetDlgItem on my MVP Tips site), and create a
user-defined message (see my essay on Message Management on my MVP
Tips site). Then do something like the following:

In the view that is supporting the file event (perhaps the main frame,
also, but a CWnd-derived class), create a member variable,
        CMyStatusDialog statusdlg;

When you start the file scan, do something like
        statusdlg.Create(CMyStatusDialog::IDD);
which creates the modeless dialog. When you have a filename, say in
the CString variable "filename", you can do
        statusdlg.SendMessage(UWM_FILE_NOTIFICATION, 0,

(LPARAM)(LPCTSTR)filename);

in the modeless dialog, add to the message map
        ON_MESSAGE(UWM_FILE_NOTIFICATION, OnFileNotification)
or
        ON_REGISTERED_MESSAGE(...same as above...)
depending on whether use use a WM_APP (DO NOT use WM_USER) or
RegisterWindowMessage to assign the code. The handler looks like

LRESULT CMyStatusDialog::OnFileNotification(WPARAM, LPARAM lParam)
    {
     LPCTSTR p = (LPCTSTR)lParam;
     c_Status.SetWindowText(p);
     return 0; // return value doesn't matter, 0, is as good as any
    }

                                joe

Quote:

>Hello,

>In a Win32 dialog-based MFC VC++ 6 program (not a console program), I'm
>trying to
>provide feedback to the user about which files I am processing.  I don't
>want the user to have to hit "OK" on a MessageBox().  I just want the file
>names to "zoom" through in some sort of message box, kind of like when you
>install software and you get "Checking System Requirements...", then
>"Installing program files...", then "Updating Registry...", etc. without a
>need for the user to hit an OK Button.

>Can someone help me out with this...I'm well versed in C and console-like
>programming, where I would just use printf() to provide feedback.  All I can
>find for messages in Visual C++ is MessageBox() or AfxMessageBox().  Each of
>these always puts an OK Button on the message, which isn't what I need.
>Any help is deeply appreciated.  Thanks!

Joseph M. Newcomer [MVP]

Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm


Fri, 04 Jul 2003 04:55:30 GMT  
 Multiple Messages without an OK Button
I am not certain that a modeless dialog is required here. As long as user
interaction is limited to this one dialog window, then a modal dialog with
notifications to its parent should suffice.

Dave Smith


Quote:
> I think that one thing that might be important is to use a modeless
dialog.
> If so, then some help with that is at:

> http://www.cpp.atfreeweb.com/ModelessDialogs.html



> > Hello,

> > In a Win32 dialog-based MFC VC++ 6 program (not a console program), I'm
> > trying to
> > provide feedback to the user about which files I am processing.  I don't
> > want the user to have to hit "OK" on a MessageBox().  I just want the
file
> > names to "zoom" through in some sort of message box, kind of like when
you
> > install software and you get "Checking System Requirements...", then
> > "Installing program files...", then "Updating Registry...", etc. without
a
> > need for the user to hit an OK Button.

> > Can someone help me out with this...I'm well versed in C and
console-like
> > programming, where I would just use printf() to provide feedback.  All I
> can
> > find for messages in Visual C++ is MessageBox() or AfxMessageBox().
Each
> of
> > these always puts an OK Button on the message, which isn't what I need.
> > Any help is deeply appreciated.  Thanks!



Fri, 04 Jul 2003 11:15:41 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. how to create a window without any close button (include OK button and X button)

2. Modal PropertySheet without Ok and Cancel buttons?

3. Message Map for CPropertySheet OK button?

4. Events and Messages associated with the ok button

5. What message come when click OK button?

6. Dialog Box two OK buttons, two Cancel buttons and TODO still on it

7. Force default button on PropertyPage instead of OK button on PropertySheet

8. Unable to print multiple copies without multiple iterations in print loop

9. Property pages without OK, Cancel

10. Extracting data from a dialog after it has ended without hitting ok

11. toolbar buttons with combo buttons not getting ON_UPDATE_COMMAND_UI messages

12. toolbar buttons with combo buttons not getting ON_UPDATE_COMMAND_UI messages

 

 
Powered by phpBB® Forum Software