1

I have an embedded Acrobat viewer in a C# winform application. The viewer is in a tab page tabPage1 in a tab control

I use the code from this answer: (1)

CAcroAVDoc acroExchAVDoc;
CAcroPDDoc pdDoc; 

void CreatePdfViewerAndOpenFile(string pdfFile)
{
    short AV_DOC_VIEW = 2;
    short PDUseBookmarks = 3;
    short AVZoomFitWidth = 2;

    Type AcroExch_AVDoc = Type.GetTypeFromProgID("AcroExch.AVDoc");
    acroExchAVDoc = (Acrobat.CAcroAVDoc)Activator.CreateInstance(AcroExch_AVDoc);
    bool ok = acroExchAVDoc.OpenInWindowEx(pdfFile, tabPage1.Handle.ToInt32(), AV_DOC_VIEW, -1, 0, PDUseBookmarks, AVZoomFitWidth, 0, 0, 0);
    pdDoc = (CAcroPDDoc)acroExchAVDoc.GetPDDoc();
}

I want to force the viewer to capture the mouse wheel so the file scrolls.

When I switch to another window and back to the application, I find the tab page name focused, and the file doesn't scroll.

I use Adobe Acrobat DC. Is there a way to do this?

Community
  • 1
  • 1
Jerry
  • 4,258
  • 3
  • 31
  • 58

1 Answers1

0

Does the viewer scroll when it is focused?

If yes just set the Focus back on the viewer when your Form gets active again.

You can always send WM_MOUSEWHEEL to the viewer. Read here

Community
  • 1
  • 1
Mauro Sampietro
  • 2,739
  • 1
  • 24
  • 50
  • How can I set the focus back to the viewer? That's the problem. I can't find any methods to do so. – Jerry May 25 '15 at 14:01
  • if you have the handle of the control/window you want to focus (it seems you do) you can p/invoke. try this http://stackoverflow.com/a/28604906/711061. – Mauro Sampietro May 25 '15 at 15:14