سؤال

I have embedded an Adobe Reader ActiveX control as a child window in an MFC application, but if the Reader has focus, none of the accelerators defined in my MFC application are triggered, regardless of whether they are used by Adobe Reader or not. If I embed other ActiveX controls using the same method, I have no problem detecting my accelerators.

I have used the Visual Studio 2008 IDE to generate a wrapper for the Adobe Reader ActiveX control (called CAcroAXDocShim by default). The code used to create the control during WM_INITDIALOG handling is:

m_ctrl.Create(_T("PDF Viewer"), WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_TABSTOP, CRect(5, 5, 400, 300), this, 1001);
m_ctrl.LoadFile(_T("C:\\auslab\\test.pdf"));

The window appears, loads the PDF correctly, and works fine, but I have not been able to intercept keyboard input if the ActiveX control has focus, either by:

  • Using accelerators
  • PreTranslateMessage on the CWinApp-derived class
  • PreTranslateMessage on the window class of the parent window of the ActiveX control
  • Handling WM_SYSCOMMAND

In fact, I tried to set a breakpoint on the WM_KEYDOWN message for my key in the main Window message loop, and it never seemed to be hit when the ActiveX control had focus. I have tried using a keyboard hook in my app to override the key handling of the control, but it seems to work unreliably - it will operate for a little while, but after some interaction, the keyboard hook stops entirely.

Any ideas? Thanks in advance.

هل كانت مفيدة؟

المحلول

according to the link below, "the events are not passed on to the container."
http://forums.adobe.com/thread/906756

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top