WM_NEXTDLGCTL to hi-lite edit control

I am trying to highlite an edit control when the user first enters the dialog box to indicate that a field must be filled in. I have tried many many ways to accomplish this but none successful. Last input I got from here was to use WM_NEXTDLGCTL. WM_NEXTDLGCTL states that, unlike SETFOCUS, it modifies the border around the control. It also says to use PostMessage. I assume that this means that the background is microsoft blue and the text is white.

Well this is what I am doing;  //some of this is psuedo code

Constructor {
 pCustName = new TEdit(this, IDC_IN_NAME);
 // other controls instantiated

void Dialog::SetupWindow{
   PostMessage(WM_NEXTCLGCTL, ID_IN_NAME, 1);

void Dialog::EvNextDlgtCtl(UINT, hctOrDir, UINT isHctl){
   pCustName->SetText("Enter Name");

The dialog displays with the text Enter Name without the text being highlited. What am I doing wrong? Also, what are the parameters to EvNextDlgCtl??
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dutchAuthor Commented:
Adjusted points to 200
dutchAuthor Commented:
No Takers????

There is a simple way to do the job :

- declare a TEdit* xxx  member in your dialog derived class

- in the constructor of that class, you have to put :
       xxx = new TEdit(..........);

- in SetupWindow of the dialog class
- in destructor :   delete xxx;

et voilà !

I usually do this for all my forms ( for example an edit field has been reserved for storing keys )

Hope this helps.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

dutchAuthor Commented:
Sorry, but it didn't work. First, to make sure everyone understands the question, I want the text "Enter Customer Name" highlited (blue background, white letters) when the dialog is instantiated. This is like what happens to your userid if you enter the wrong password logging in to this site.

the code is as follows;
in header file

      TEdit* pCustName;

in CPP file

CustDialog::CustDialog(TWindow* Parent)           //constructor
                      :TDialog(Parent, IDD_CUST_DIALOG){  
   SetCaption("Customer Data");
   pCustName = new TEdit(this, IDC_IN_NAME);

void CustDialog::SetupWindow{
   pCustName->SetText("Enter Customer Name");
   // i have tried with either one being first - no difference

   delete pCustName;

The dialog comes up with the TStatic control Customer Name and the TEdit control next to it with the text "Enter Customer Name". However it is not highlited - the text is in black and the background is white. Everything else does work. I can get the text and file for later use.

That's strange!

In my program, I almost wrote the same code as yours ( SetDlgItemText instead of SetText ) to get the name of a project
and it works!
It sounds like something has been overwritten!


If you wish, ask the supervisor for my E-mai! address and I 'll send you an Edit derived class ( with effects ) so you could try it.

dutchAuthor Commented:
Jean-Paul, I did not try to set/kill focus by placing a WM_SETFOCUS message on the queue (I assume you mean using the PostMessage function). I will be on a business trip until this weekend and wil not have the time to test this out. If I figure out how to send a note to the adminstrator to get you id while I am in this session, I will do that. Thanks...
To get my ig:
 get to the Expert-Exchange 's main window
 toggle FAQ
 #14 How to contact....
Send a message

I have tried it this way!

dutchAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.