Re: Caret problems with IE7



I have a similar problem with the caret. In my case I have an ActiveX
control with a custom edit control inside it. As described in the Windows
API documentation I call CreateCaret from the WM_SETFOCUS and DestroyCaret
from the WM_KILLFOCUS. However, there are times when my caret is not visible
when it should be visible. The control will have the focus because when I
type, the characters go where the caret should be, but the caret is not
visible. If I change my code to call DestroyCaret followed by CreateCaret
whenever I move the caret it works fine, but like you I don't want to do that.

Another clue is that this seems to always happen when closing a modeless
dialog and setting the focus back to my edit control. I used the debugger to
make sure the appropriate message are happening in the correct order and they
seem to be.

My theory is that IE7 is somehow calling CreateCaret after I do, and that
give IE7 the ownship and doesn't allow me to show it.

"Mark Smith" wrote:

Any ideas here?

Mark Smith

"Mark Smith" <sti@xxxxxxxxxxxxx> wrote in message
news:ujHjJME2GHA.1548@xxxxxxxxxxxxxxxxxxxxxxx
System: Windows XP SP2
IE version: 7 RC1
Language: VC6

We are creating an e-mail program, using WebBrowser to display HTML
e-mails. Our e-mail editor consists of the typical controls you'd see on
an e-mail editor: "To" button, "To" edit control, (ditto for CC and BCC),
Subject edit control, a checkbox that lets the user save a copy of the
e-mail when sending, the WebBrowser, and a custom ListView that displays
attachments.

Everything worked fine and dandy until I installed IE7. Now if I have
focus in the WebBrowser and then try to click on one of the recipient edit
controls, focus does switch, but the caret doesn't show up. When I click
in another recipient edit control and back, the caret reappears.

I'm not sure if these details will help, but here they are:
The window that these controls are contained in is a CFormView.
I traced this behavior down to: COccManager::IsDialogMessage(), eventually
called from CFormView::PreTranslateMessage(). If I don't execute
UIDeactivateIfNecessary(), the caret show up appropriately.

To me, it seems that what is going on here is that the WebBrowser control
is not relinquishing control of the caret resource. If I try to call any
caret methods (ShowCaret, SetCaretPos, etc.) on the window that just
received focus, I get an access denied error. Creating a new caret does
work, but that's not really what I want to do.

I can work around this by forcing focus to a different control and then
back to the control in question. And I will do this if I have to. But
I'm wondering if I'm just missing something here, or if there is a bug in
IE7? The fact that it worked fine with IE6 leads me to think it is a bug
in IE7.

Thanks for any help.

Mark Smith

P.S. Sorry if this isn't the right group. Please let me know if there
would be a better one to ask this question in!




.