http://groups.google.com/groups?hl=ko&lr=&ie=UTF-8&oe=UTF-8&selm=8uq0btk51smg07ihjlv7ubolvcd4mvtjsm%404ax.com&rnum=2
Michael Lim wrote:
>I put the TMemo control on the ActiveX form. And called this ocx in the IE5.
>By the way, this ocx didn't recognize the back space key and arrow keys.
>When I press the backspace key, IE5 move backward url...
>What can I do?
Dear Michael,
recently I have found your same problem with a TCustomControl
inherited control (P.S: TMemo is also a descendent of TCustomControl).
After many days of pure desperation I have found a Microsoft Document
in MSDN Library - October 2000, in which the author explain the cause
of my problems. The original document is wrote with MFC structure in
mind and so I have extract and adapted that infos in following note:
SYMPTOMS:
- When a Visual Basic Form or IEx page contains the Builder C++
ActiveX control derived from a VCL TCustomControl class, and the
control has focus, the ARROW keys (and others navigation keys)
are not recognized.
CAUSE:
- This behavior is the result of ARROW keys being accelerator keys.
Accelerator keys are handled in the main message loop of the
containing application before the window procedure of the control
is called. As a result, the ActiveX control is not aware that the
ARROW keys have been pressed. Other accelerator keys include the TAB,
END, and HOME keys.
RESOLUTION:
- The problem can be resolved by adding the following code to Builder
C++ ActiveX Control Wizzard code generated and precisely in the
CoClass of VCL control.
< -- snip from "MemoImpl1.h -- >
class ATL_NO_VTABLE TMemoXImpl : VCLCONTROL_IMPL
(
TMemoXImpl,
MemoX,
TMemo,
IMemoX,
DIID_IMemoXEvents
)
{
void __fastcall ChangeEvent(TObject *Sender);
void __fastcall ClickEvent(TObject *Sender);
void __fastcall DblClickEvent(TObject *Sender);
void __fastcall KeyPressEvent(TObject *Sender, char &Key);
public:
// manually added for VB & IEx navigation key compatibility
BOOL PreTranslateAccelerator(LPMSG pMsg, HRESULT &hRet)
{
switch (pMsg->message)
{
case WM_KEYDOWN:
case WM_KEYUP:
switch (pMsg->wParam)
{
// !!!!! insert here your required navigation keys !!!!
case VK_UP:
case VK_DOWN:
case VK_LEFT:
case VK_RIGHT:
case VK_HOME:
case VK_END:
case VK_TAB:
SendMessage
(
pMsg->hwnd,
pMsg->message,
pMsg->wParam,
pMsg->lParam
);
return TRUE;
}
}
return FALSE;
}
void InitializeControl()
{
m_VclCtl->OnChange = ChangeEvent;
m_VclCtl->OnClick = ClickEvent;
m_VclCtl->OnDblClick = DblClickEvent;
m_VclCtl->OnKeyPress = KeyPressEvent;
}
< -- end snip from "MemoImpl1.h -- >
저는 일단 이 코드로 해결이 되네요.. 참고하시구요.....
(금방 기본적으로 Tab 키랑, Arrow 키등만 확인했는데, 설마 나중에 다른 문제가 생기지는 않겠죠.. )
또 다른 내용들도 있더군요.. 그런데 저한테는 너무 어려워서리.. ^^;;;
http://groups.google.com/groups?q=ActiveX+Lost+Key+group:borland.public.cppbuilder.*&hl=ko&lr=&ie=UTF-8&oe=UTF-8&group=borland.public.cppbuilder.*&selm=94nlr9%24or116%40bornews.inprise.com&rnum=1
http://groups.google.com/groups?q=ActiveX+Lost+Key+group:borland.public.cppbuilder.*&hl=ko&lr=&ie=UTF-8&oe=UTF-8&group=borland.public.cppbuilder.*&selm=3ad337eb_2%40dnews&rnum=3