I'm trying to use a read-only rich edit control to display some formatted text. Is there a way to get the rich edit control to hide the input caret? Thanks. David Liebtag
On Jul 11, 5:12 pm, "David Liebtag" wrote: > I'm trying to use a read-only rich edit control to display some formatted > text. Is there a way to get the rich edit control to hide the input caret? > > Thanks. > > David Liebtag Hi, The answer is within your question, or should I say you already answered your question. :-) HideCaret() ShowCaret() http://msdn.microsoft.com/en-us/library/ms648403(VS.85).aspx http://msdn.microsoft.com/en-us/library/ms648406(VS.85).aspx Kellie.
Kellie, I already tried HideCaret; it does not hide the rich edit control's caret. That's why I asked on the news group. David
David Liebtag schrieb: > I already tried HideCaret; it does not hide the rich edit control's caret. > That's why I asked on the news group. Does HideCaret return True? If not, what does GetLastError say? Here it's an access violation (5). -- Remember that whatever misfortune may be your lot, it could only be worse in Cleveland. -- National Lampoon, "Deteriorata" ...und wech Danny <dannys9 (at) gmx (dot) de>
I have tried both HideCaret and DestroyCaret, they both return non-zero values. If I call them again, they return 5. And yet, the RichEdit control continues to show a caret. I wonder if RichEdit is using a system IME which is in another process and so is not affected by the caret APIs? I've tried making the richedit not use an IME and that didn't work either. David Liebtag
I assume you are using the correct window handle. Where are you using HideCaret? "David Liebtag" wrote in message news:%233xzObS5IHA.4448@TK2MSFTNGP05.phx.gbl... >I have tried both HideCaret and DestroyCaret, they both return non-zero >values. If I call them again, they return 5. And yet, the RichEdit >control continues to show a caret. > > I wonder if RichEdit is using a system IME which is in another process and > so is not affected by the caret APIs? I've tried making the richedit not > use an IME and that didn't work either. > > David Liebtag > >
I have tried using both the handle of the richedit window and NULL (which the docs say will cause it to search the current task for the window that owns the caret.) Neither work. I'm not sure what you mean when you ask where I am using HideCaret. I create the richedit window with the WS_POPUP and ES_READONLY styles (among others). I send EM_SETTEXTEX the window's text. I use SetWindowPos to position, size, and activate the window. I send EM_EXSETSEL to unselect all the characters. I call HideCaret. This all happens in response to a mouse click in another window. (I am trying to provide popup information in response to the click.) David Liebtag
On Jul 15, 10:30 am, "David Liebtag" wrote: > I have tried using both the handle of the richedit window and NULL (which > the docs say will cause it to search the current task for the window that > owns the caret.) Neither work. > > I'm not sure what you mean when you ask where I am using HideCaret. > > I create the richedit window with the WS_POPUP and ES_READONLY styles (among > others). > I send EM_SETTEXTEX the window's text. > I use SetWindowPos to position, size, and activate the window. > I send EM_EXSETSEL to unselect all the characters. > I call HideCaret. > > This all happens in response to a mouse click in another window. (I am > trying to provide popup information in response to the click.) > > David Liebtag Hi, That's why the function is not working out for you because you are not handling the required notification message. You need to process the following message and then call the function to hide the system caret: case EN_SETFOCUS: HideCaret(hwndCtl); Break; http://msdn.microsoft.com/en-us/library/bb761685(VS.85).aspx Kellie.
I tried handling the EN_SETFOCUS in the parent's procedure and although I do get the notification, calling HideCaret() still has no effect. David Liebtag
I mean what is the program doing when HideCaret is called. If HideCaret is called when the window is created then that is not likely to work. I am not sure how carets work but I am nearly certain that you need to hide the caret each time the mouse enters the window. I think windows do not retain the visibility status of carets. So if it were me, I would search for samples of using HideCaret. The Windows SDK has many sample programs; search for HideCaret in them. "David Liebtag" wrote in message news:Oo45CCq5IHA.5052@TK2MSFTNGP03.phx.gbl... > > I'm not sure what you mean when you ask where I am using HideCaret.