sanx72
July 2nd, 2009, 09:20 AM
Hi,
I've written a C++ OCX control. This sits inside a VB.NET UserControl which is then presented to the client within Internet Explorer.
I wanted to display a custom caret shape so I coded it up and when I enter the edit control, the caret appears ok, blinking away as you'd expect. If I move to another control within the OCX and then move back to the edit control, the caret is shown correctly.
However, if I move focus to the edit control, then show then hide a message box the caret disappears, even though the focus is in the edit control.
I removed the caret code but still get the same behaviour.
Within the OCX, I create edit control windows, based on the standard EDIT class; e.g.
lpfnEdit = sWndSys.lpfnWndProc;
// Clone the Emulator Entry from the System Edit
sWndReg.lpszClassName = "MYEDIT";
sWndReg.lpfnWndProc = MyEntry;
sWndReg.style = sWndSys.style & ~CS_PUBLIC & ~CS_CLIPSIBLINGS;
RegisterClass(&sWndReg);
:
hwnd = CreateWindow("MYEDIT", pszEditText,
style, wr.x, wr.y, wr.cx, wr.cy,
parentHwnd,
(HMENU)nId, hAppInstance, NULL);
:
In the custom Window Proc I did have my own Paint to draw my own border, and some additional key handling routines, but I took all that out so that it just calls the standard EDIT class WndProc and I still get the same issue.
Have any other Win32 developers experienced a similar problem and if so, how did you get around it?
Cheers
Rich
I've written a C++ OCX control. This sits inside a VB.NET UserControl which is then presented to the client within Internet Explorer.
I wanted to display a custom caret shape so I coded it up and when I enter the edit control, the caret appears ok, blinking away as you'd expect. If I move to another control within the OCX and then move back to the edit control, the caret is shown correctly.
However, if I move focus to the edit control, then show then hide a message box the caret disappears, even though the focus is in the edit control.
I removed the caret code but still get the same behaviour.
Within the OCX, I create edit control windows, based on the standard EDIT class; e.g.
lpfnEdit = sWndSys.lpfnWndProc;
// Clone the Emulator Entry from the System Edit
sWndReg.lpszClassName = "MYEDIT";
sWndReg.lpfnWndProc = MyEntry;
sWndReg.style = sWndSys.style & ~CS_PUBLIC & ~CS_CLIPSIBLINGS;
RegisterClass(&sWndReg);
:
hwnd = CreateWindow("MYEDIT", pszEditText,
style, wr.x, wr.y, wr.cx, wr.cy,
parentHwnd,
(HMENU)nId, hAppInstance, NULL);
:
In the custom Window Proc I did have my own Paint to draw my own border, and some additional key handling routines, but I took all that out so that it just calls the standard EDIT class WndProc and I still get the same issue.
Have any other Win32 developers experienced a similar problem and if so, how did you get around it?
Cheers
Rich