Edit Box Cursor Problem

Posted on 2004-11-16
Last Modified: 2013-11-20
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.
Question by:colossus_21
    LVL 6

    Accepted Solution

    try this in ur dialog (or parent window of CEdit)
    //in your message map
      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


      void CYourDlg::OnKillFocusEdit()

    Author Comment

    I tried using the SetCaretPos, but the caret didn't go to the
    position I specified.

    Author Comment

    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.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    repeateFront java challenge 31 80
    Turn a spreadsheet into a vba executable. 2 56
    lucky13 challenge 11 96
    no14 challenge 14 46
    Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
    If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now