Click here to Skip to main content
15,918,976 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Make Edit Control un-editable Pin
Maximilien19-Feb-04 3:37
Maximilien19-Feb-04 3:37 
GeneralRe: Make Edit Control un-editable Pin
dabs19-Feb-04 3:50
dabs19-Feb-04 3:50 
GeneralRe: Make Edit Control un-editable Pin
David Crow19-Feb-04 5:54
David Crow19-Feb-04 5:54 
GeneralRe: Make Edit Control un-editable Pin
Prakash Nadar19-Feb-04 6:17
Prakash Nadar19-Feb-04 6:17 
GeneralRe: Make Edit Control un-editable Pin
David Crow19-Feb-04 6:46
David Crow19-Feb-04 6:46 
GeneralRe: Make Edit Control un-editable Pin
Steve S19-Feb-04 7:30
Steve S19-Feb-04 7:30 
GeneralRe: Make Edit Control un-editable Pin
Prakash Nadar19-Feb-04 14:07
Prakash Nadar19-Feb-04 14:07 
GeneralRe: Make Edit Control un-editable Pin
Ravi Bhavnani19-Feb-04 7:26
professionalRavi Bhavnani19-Feb-04 7:26 
I think you'll find it much easier to make the control read-only and handle the drawing of the edit control to make it look like it's a non-read-only control. Handle WM_CTLCOLORSTATIC and do something like this:
LRESULT CMyDlg::OnCtlColorStatic
  (WPARAM wParam, LPARAM lParam)
{
  // Override this method to impart a normal background to the edit
  // control
  HDC hDC = (HDC)wParam;
  HWND hwndCtl = (HWND) lParam;
  UINT uCtrlId = ::GetDlgCtrlID (hwndCtl);
  if (uCtrlId == IDC_MY_EDIT) {
      CDC *pDC = CDC::FromHandle (hDC);
      pDC->SetBkColor (RGB (255, 255, 255));
      return (LRESULT) (HBRUSH) m_brushBkg.GetSafeHandle();
  }
  return Default();
}
Of course, you should use GetSysColor() instead of the hardcoded constant RGB (255,255,255). You'll also need to create/destroy the background CBrush within your dialog.

/ravi

My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com

GeneralRe: Make Edit Control un-editable Pin
J.B.19-Feb-04 15:38
J.B.19-Feb-04 15:38 
GeneralRe: Make Edit Control un-editable Pin
Ravi Bhavnani20-Feb-04 4:09
professionalRavi Bhavnani20-Feb-04 4:09 
GeneralRe: Make Edit Control un-editable Pin
J.B.20-Feb-04 5:12
J.B.20-Feb-04 5:12 
QuestionHow do I create AVI animation from series of BMPs? Pin
johannks19-Feb-04 3:23
johannks19-Feb-04 3:23 
AnswerRe: How do I create AVI animation from series of BMPs? Pin
Admiral Quality19-Feb-04 11:15
Admiral Quality19-Feb-04 11:15 
GeneralSoundcards - advanced interfaces Pin
peterchen19-Feb-04 3:14
peterchen19-Feb-04 3:14 
GeneralRe: Soundcards - advanced interfaces Pin
Prakash Nadar19-Feb-04 5:18
Prakash Nadar19-Feb-04 5:18 
GeneralOverriding HyperLink in CHtmlEditCtrl Pin
panzerdivisionmarkus19-Feb-04 2:43
panzerdivisionmarkus19-Feb-04 2:43 
GeneralExecuting an exe file without using shell commands like execv or ShellExecute etc Pin
Member 48989819-Feb-04 1:05
Member 48989819-Feb-04 1:05 
GeneralRe: Executing an exe file without using shell commands like execv or ShellExecute etc Pin
David Crow19-Feb-04 3:02
David Crow19-Feb-04 3:02 
GeneralRe: Executing an exe file without using shell commands like execv or ShellExecute etc Pin
Michael Dunn19-Feb-04 4:41
sitebuilderMichael Dunn19-Feb-04 4:41 
GeneralRe: Executing an exe file without using shell commands like execv or ShellExecute etc Pin
Prakash Nadar19-Feb-04 5:14
Prakash Nadar19-Feb-04 5:14 
GeneralRe: Executing an exe file without using shell commands like execv or ShellExecute etc Pin
Anonymous19-Feb-04 12:37
Anonymous19-Feb-04 12:37 
QuestionHow to make transparent CProgress in CDialog ? Pin
vgrigor19-Feb-04 0:12
vgrigor19-Feb-04 0:12 
AnswerRe: How to make transparent CProgress in CDialog ? Pin
Prakash Nadar19-Feb-04 2:20
Prakash Nadar19-Feb-04 2:20 
GeneralRe: How to make transparent CProgress in CDialog ? Pin
vgrigor19-Feb-04 4:19
vgrigor19-Feb-04 4:19 
QuestionChange the bitmap in a Toolbar? Pin
LittleYellowBird19-Feb-04 0:07
LittleYellowBird19-Feb-04 0:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.