• Advertisement

Archived

This topic is now archived and is closed to further replies.

Changing Background Color Of An Edit Control

This topic is 5953 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys. I am tring to make an Edit control that is read only, but I want it to have a white background instead of a gray one. How would I do that? Also, I am having trouble figuring out how to use the messages sent by the controls, such as when I receive a BN_CLICKED message. I tried:
  
case WM_COMMAND:
{
  switch(LOWORD(wparam))
   {
    case BN_CLICKED:
     {
      if(hQuitButton == lparam)
       {
        PostQuitMessage(0);
        return 0;
        break;
       }
      break;
    default:break;
  }	
}
  
but that didn't work. Edited by - Squeejee on November 6, 2001 7:19:38 PM

Share this post


Link to post
Share on other sites
Advertisement
for color see WM_CTLCOLOREDIT at:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/editcon_8rw4.asp?frame=true

for button messages you have the wrong word -- should be:

(HIWORD(wParam) == BN_CLICKED)

then you check LOWORD for the button id. isn''t windows hopelessly confusing?

Share this post


Link to post
Share on other sites
So its:

  
case WM_COMMAND:
{
switch(HIWORD(wparam))
{

case BN_CLICKED:
{

if((LOWORD(wparam)) == hQuitButton)
{
PostQuitMessage(0);
return 0;
break;
}
break;
}

default:break;
}
}



That doesn't work either.

Edited by - Squeejee on November 6, 2001 8:08:14 PM

Share this post


Link to post
Share on other sites
Thanks, now it works. Now about the Edit control. It says on MSDN that to use the color msg thing, it can''t be a read-only edit control. Is that true?

Share this post


Link to post
Share on other sites

  • Advertisement