HtmlTaskPane.HtmlWindow プロパティ
カスタム作業ウィンドウの HTML ドキュメントで作業するための MSHTML IHTMLWindow2 インターフェイスへの参照を取得します。
名前空間: Microsoft.Office.InfoPath
アセンブリ: Microsoft.Office.InfoPath (microsoft.office.infopath.dll 内)
構文
'宣言
Public MustOverride ReadOnly Property HtmlWindow As Object
'使用
Dim instance As HtmlTaskPane
Dim value As Object
value = instance.HtmlWindow
public abstract Object HtmlWindow { get; }
プロパティ値
カスタム作業ウィンドウの HTML ファイルに関連付けられている IHTMLWindow2 オブジェクト。
例外処理
例外の種類 | 条件 |
---|---|
フォーム テンプレートが、[フォームのオプション] ダイアログ ボックスの [セキュリティと信頼] カテゴリを使用して [完全信頼] として構成されていません。 |
コメント
HtmlWindow プロパティを使用すると、作業ウィンドウの HTML コードを扱いながら、プライマリ フォーム コードから作業ウィンドウの HTML コードに記述されているスクリプト関数を呼び出したり、IHTMLWindow2 インターフェイスが提供する任意のプロパティとメソッドで作業することができます。
メモ : |
---|
HtmlWindow プロパティは、機能的には HtmlDocument プロパティと同じですが、完全に信頼されたフォームを使用する場合にのみ使用できます。フォームが完全に信頼されていない場合は、代わりに HtmlDocument プロパティを使用できます。 |
このメンバは、[フォームのオプション] ダイアログ ボックスの [セキュリティと信頼] カテゴリを使用して完全信頼で実行するように構成されているフォーム テンプレートから開かれたフォームだけがアクセスできます。このメンバは、直接呼出し元に対する完全な信頼が必要であり、部分的に信頼されたコードで使用することはできません。詳細については、MSDN の「部分的に信頼されたコードからライブラリを使用する」を参照してください。
この型またはメンバは、Microsoft Office InfoPath 2007 で開いているフォームで実行されているコードからのみアクセスできます。
例
次の例では、HtmlTaskPane クラスの HtmlWindow プロパティを使用して、完全に信頼されたフォームのカスタム作業ウィンドウの IHTMLWindow2 オブジェクトへの参照を設定しています。その後、このコードは、カスタム作業ウィンドウの HTML コードで定義されている TaskPaneSwitchView カスタム関数を呼び出します。
// Get a reference to the custom task pane. It is always index [0]
// in the TaskPanes collection.
HtmlTaskPane custom = (Microsoft.Office.InfoPath.HtmlTaskPane)
this.CurrentView.Window.TaskPanes[0];
// Get a reference to the parent window of the task pane.
IHTMLWindow2 window = (IHTMLWindow2)custom.HtmlWindow;
// Call into script through CLR late binding mechanism.
window.GetType().InvokeMember(
"TaskPaneSwitchView", // late bound method name.
System.Reflection.BindingFlags.InvokeMethod | // binding flags
System.Reflection.BindingFlags.DeclaredOnly |
System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.Instance,
null, // binder object
window, // target object
null); // method arguments
' Get a reference to the custom task pane. It is always index (0)
' in the TaskPanes collection.
Dim custom As HtmlTaskPane = _
DirectCast(Me.CurrentView.Window.TaskPanes(0), _
Microsoft.Office.InfoPath.HtmlTaskPane)
' Get a reference to the parent window of the task pane.
Dim window As IHTMLWindow2 = DirectCast(custom.HtmlWindow, _
IHTMLWindow2
' Call into script through CLR late binding mechanism.
window.GetType().InvokeMember( _
"TaskPaneSwitchView", _
System.Reflection.BindingFlags.InvokeMethod Or _
System.Reflection.BindingFlags.DeclaredOnly Or _
System.Reflection.BindingFlags.Public Or _
System.Reflection.BindingFlags.Instance, _
Nothing, _
window, _
Nothing)
関連項目
参照
HtmlTaskPane クラス
HtmlTaskPane のメンバ
Microsoft.Office.InfoPath 名前空間