From: John_Doe on
I have dialog-based MFC application. There are 2 buttons at the bottom
of the dialog - "Start" and "Finish". After I press "Start" lengthy
operation is performed. At the end of this operation I want "Finish"
button to become selected automatically.

Using

GetDlgItem(IDFINISH)->SetActiveWindow();

does make "Finish" button active. That is if after lengthy operation
is completed and I press "Space" the effect is the same as when I
pressed "Finish" button. However, "Finish" button doesn't look like it
was tabbed to - it is missing that 1 pixel thick black border and
button text is not enclosed in dashed rectangle.

Can anyone suggest how to achieve the desired effect?
From: David Lowndes on
>I have dialog-based MFC application. There are 2 buttons at the bottom
>of the dialog - "Start" and "Finish". After I press "Start" lengthy
>operation is performed. At the end of this operation I want "Finish"
>button to become selected automatically.
>
>Using
>
> GetDlgItem(IDFINISH)->SetActiveWindow();
>
>does make "Finish" button active.

Try GotoDlgCtrl

Dave
From: John_Doe on
On May 12, 5:08 pm, David Lowndes <Dav...(a)example.invalid> wrote:
> >I have dialog-based MFC application. There are 2 buttons at the bottom
> >of the dialog - "Start" and "Finish". After I press "Start" lengthy
> >operation is performed. At the end of this operation I want "Finish"
> >button to become selected automatically.
>
> >Using
>
> > GetDlgItem(IDFINISH)->SetActiveWindow();
>
> >does make "Finish" button active.
>
> Try GotoDlgCtrl
>
> Dave

GotoDlgCtrl() gets me closer to what I want. However, after using
GotoDlgCtrl() BOTH buttons have 1 pixel thick black border and button
text is still not enclosed in dashed rectangle.
From: David Lowndes on
>GotoDlgCtrl() gets me closer to what I want. However, after using
>GotoDlgCtrl() BOTH buttons have 1 pixel thick black border and button
>text is still not enclosed in dashed rectangle.

1. Send the BM_SETSTYLE message to the current default push button to
change its border to that of a regular push button.

2. Send a DM_SETDEFID message to the dialog box to change the ID of
the default push button.

3. Send the BM_SETSTYLE message to the new default push button to
change its border to that of a default push button.

Dave