CComboBox Read-Only

Ok...I know that you can get the child window of the combo box and set it to read only. But how do I make it so the box is still white and not gray. Also...I do not want to se the blinking caret in the window.
SGyvesAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Roshan DavisCommented:
Map WM_CTLCOLOR, dialog will sent this message for this EDIT as *STATIC* (only when disabling an EDIT)

Try this code

HBRUSH CTestPrograms_DLGDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
      HBRUSH hbr;
      
      if ( nCtlColor == CTLCOLOR_STATIC )
      {
            hbr = (HBRUSH)GetStockObject(WHITE_BRUSH);
      }
      else
      {
            hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
      }
            
      // TODO: Return a different brush if the default is not desired
      return hbr;
}

You can check the window pointer or ID for coloring  specific read only edit.

I'm checking the Blinking caret issue

Good Luck
0

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
PriyeshCommented:
To remove the blinking caret, once you have the edit window,

pEdit->HideCaret() ;
0
Roshan DavisCommented:
addition to Priyesh's comment:
map EN_SETFOCUS and there also call "HideCaret()"

Rosh :)
0
CompTIA Cloud+

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

AlexFMCommented:
Maybe all you need is dropdown list style (just a guess...)
0
SGyvesAuthor Commented:
OMG!!! Alex....you are absolutely right.....LOL
0
SGyvesAuthor Commented:
Although all I needed was what AlexFM suggested...I will give the points to rosh for the most direct answer to the question. Thanks.
0
AlexFMCommented:
Well... I should learn to give direct answers.
0
SGyvesAuthor Commented:
No...no...that was not my point at all....I hope you are not offended...I really appreciate your answer....I am sorry for not giving the points to you.
0
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
System Programming

From novice to tech pro — start learning today.