0

ツールバー付きの ActiveX コントロール (Adobe PDF Reader) があります。このコントロールは、ツールバーから使用できる一部の機能 (主に検索機能) を公開しません。プログラムでツールバーの検索フィールドを見つけ、テキストを入力して検索を呼び出す方法を探しています (このフィールドで Enter キーを押すのと同じです)。それを行う最も正確な方法は何ですか?System.Windows.Automation 名前空間に基づくソリューションが見つかりましたが、正しく動作させることができませんでした。

ありがとう。

私が試したコードは次のとおりです。

Dim pdfElement As AutomationElement = AutomationElement.FromHandle(AxAcroPDF1.Handle)
Dim condition As New AndCondition(New OrCondition(New PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Edit), New PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Document), New PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Text)), New PropertyCondition(AutomationElement.IsTextPatternAvailableProperty, True))
Dim ac As AutomationElementCollection = pdfElement.FindAll(TreeScope.Descendants, condition)

For Each element As AutomationElement In ac

    If element.Current.Name = "Find" Then
        element.SetFocus()
        SendKeys.Send("TESTSEARCH")
    End If

Next
4

1 に答える 1

1

前の質問と同じ答え。小売自動化インターフェースには FindText() メソッドがあります。API ドキュメントへのリンクは既に提供しています。

于 2010-08-29T13:35:32.493 に答える