Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

How to prevent that the DialogBox close when you press return ....500 points

Avatar of Thomas Stockbruegger
Thomas StockbrueggerFlag for Germany asked on
Visual C++.NET
7 Comments1 Solution423 ViewsLast Modified:
how can I prevent that the DialogBox will close after I pressed return?

1) I don´t want to use PreTranslateMessage....catch return with VK_RETURN

2) I know when I still have the default OK-Button to do this:
    a) overrite/insert  the BN_CLICKED from the OK-Button with new name f.e. OnOK
    b) change the IDOK to another name f.e. ID_OK
    c) insert a BN_CLICKED with OnBnClickedOK for the ID_OK
   This will work great....I have prevented the close of return or push-the-Ok-Button
    d) now I can delete the default Ok-Button...and everything works still fine.

I have already deleted the default OK-Button (some times before)
How can I prevent the close of the DialogBox with return?

I tried this already: I have added a new Button...changed the ID....and did everything from
(2) above.
But when I finaly want to delete the new OK-Button.... the DialogBox with close on return
I can change the new button to invisible...that will work (when I set the focus to the new button)....but I want the focus to something else.

I hope you can understand my problem.
Thank you.

500 Points with grade A

Avatar of AlexFM

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answers