Edit Box Cursor Problem

Does anyone in here knows how to change the properties of the cursor inside
an edit box. I want to change the default cursor color or hide the cursor inside
an edit box.

Hope anyone can shed some light on this matter.
colossus_21Asked:
Who is Participating?
 
Amritpal SinghConnect With a Mentor Commented:
try this in ur dialog (or parent window of CEdit)
//in your message map
ON_EN_SETFOCUS(IDC_EDIT1, OnSetFocusEdit)
  ON_EN_KILLFOCUS(IDC_EDIT1, OnKillFocusEdit)

  void CYourDlg::OnSetFocusEdit()
  {
    //m_cx and m_cy might be the default font's
    //(average) character size
    CreateSolidCaret(m_cx, m_cy);

    //you figure out how to set m_pointCaret
    SetCaretPos(m_pointCaret);

    ShowCaret();
  }

  void CYourDlg::OnKillFocusEdit()
  {
    HideCaret();
    GetCaretPos(...);
    ::DestroyCaret();
  }
0
 
colossus_21Author Commented:
I tried using the SetCaretPos, but the caret didn't go to the
position I specified.
0
 
colossus_21Author Commented:
Naahhh, disregard my last message. I was able to figure it out. The OnSetFocus body on my CEdit base class is having some conflict with the OnSetFocus of the dialog on edit box,
that code snippet you posted works just fine, well I'll just do
the color thingy.I should have read the MSDN documents about this earlier.

Thanks for the info.
0
All Courses

From novice to tech pro — start learning today.