WebView2 日本語リファレンス
WebView2インターフェース › ICoreWebView2

ICoreWebView2

COM
IID76eceacb-0462-4d94-ac83-423a6793775e継承元IUnknown自前メソッド開始 vtbl3

メソッド 58

vtbl = vtable インデックス(0始まり)。HSP等からインデックス指定でCOMメソッドを呼ぶ際に使用します。0〜2 は IUnknown。

vtbl 3 HRESULT get_Settings(ICoreWebView2Settings** settings)
settingsICoreWebView2Settings**outWebView の設定オブジェクト(ICoreWebView2Settings)を受け取るポインタである。
vtbl 4 HRESULT get_Source(LPWSTR* uri)
uriLPWSTR*out現在表示中のドキュメントの URI 文字列を受け取るポインタである。文字列は呼び出し側が解放する。
vtbl 5 HRESULT Navigate(LPWSTR uri)
uriLPWSTRinナビゲートする先の URI を指定する。
vtbl 6 HRESULT NavigateToString(LPWSTR htmlContent)
htmlContentLPWSTRin表示する HTML コンテンツの文字列を指定する。
vtbl 7 HRESULT add_NavigationStarting(ICoreWebView2NavigationStartingEventHandler* eventHandler, EventRegistrationToken* token)
eventHandlerICoreWebView2NavigationStartingEventHandler*inナビゲーション開始イベントを受け取るイベントハンドラへのポインタである。
tokenEventRegistrationToken*out登録したイベントハンドラを後で解除するためのトークンを受け取るポインタである。
vtbl 8 HRESULT remove_NavigationStarting(EventRegistrationToken token)
tokenEventRegistrationTokenin解除対象のイベントハンドラ登録を識別するトークンを指定する。
vtbl 9 HRESULT add_ContentLoading(ICoreWebView2ContentLoadingEventHandler* eventHandler, EventRegistrationToken* token)
eventHandlerICoreWebView2ContentLoadingEventHandler*inコンテンツ読み込み開始イベントを受け取るイベントハンドラへのポインタである。
tokenEventRegistrationToken*out登録したイベントハンドラを後で解除するためのトークンを受け取るポインタである。
vtbl 10 HRESULT remove_ContentLoading(EventRegistrationToken token)
tokenEventRegistrationTokenin解除対象のイベントハンドラ登録を識別するトークンを指定する。
vtbl 11 HRESULT add_SourceChanged(ICoreWebView2SourceChangedEventHandler* eventHandler, EventRegistrationToken* token)
eventHandlerICoreWebView2SourceChangedEventHandler*inソース(URI)変更イベントを受け取るイベントハンドラへのポインタである。
tokenEventRegistrationToken*out登録したイベントハンドラを後で解除するためのトークンを受け取るポインタである。
vtbl 12 HRESULT remove_SourceChanged(EventRegistrationToken token)
tokenEventRegistrationTokenin解除対象のイベントハンドラ登録を識別するトークンを指定する。
vtbl 13 HRESULT add_HistoryChanged(ICoreWebView2HistoryChangedEventHandler* eventHandler, EventRegistrationToken* token)
eventHandlerICoreWebView2HistoryChangedEventHandler*in履歴変更イベントを受け取るイベントハンドラへのポインタである。
tokenEventRegistrationToken*out登録したイベントハンドラを後で解除するためのトークンを受け取るポインタである。
vtbl 14 HRESULT remove_HistoryChanged(EventRegistrationToken token)
tokenEventRegistrationTokenin解除対象のイベントハンドラ登録を識別するトークンを指定する。
vtbl 15 HRESULT add_NavigationCompleted(ICoreWebView2NavigationCompletedEventHandler* eventHandler, EventRegistrationToken* token)
eventHandlerICoreWebView2NavigationCompletedEventHandler*inナビゲーション完了イベントを受け取るイベントハンドラへのポインタである。
tokenEventRegistrationToken*out登録したイベントハンドラを後で解除するためのトークンを受け取るポインタである。
vtbl 16 HRESULT remove_NavigationCompleted(EventRegistrationToken token)
tokenEventRegistrationTokenin解除対象のイベントハンドラ登録を識別するトークンを指定する。
vtbl 17 HRESULT add_FrameNavigationStarting(ICoreWebView2NavigationStartingEventHandler* eventHandler, EventRegistrationToken* token)
eventHandlerICoreWebView2NavigationStartingEventHandler*inフレーム内のナビゲーション開始イベントを受け取るイベントハンドラへのポインタである。
tokenEventRegistrationToken*out登録したイベントハンドラを後で解除するためのトークンを受け取るポインタである。
vtbl 18 HRESULT remove_FrameNavigationStarting(EventRegistrationToken token)
tokenEventRegistrationTokenin解除対象のイベントハンドラ登録を識別するトークンを指定する。
vtbl 19 HRESULT add_FrameNavigationCompleted(ICoreWebView2NavigationCompletedEventHandler* eventHandler, EventRegistrationToken* token)
eventHandlerICoreWebView2NavigationCompletedEventHandler*inフレーム内のナビゲーション完了イベントを受け取るイベントハンドラへのポインタである。
tokenEventRegistrationToken*out登録したイベントハンドラを後で解除するためのトークンを受け取るポインタである。
vtbl 20 HRESULT remove_FrameNavigationCompleted(EventRegistrationToken token)
tokenEventRegistrationTokenin解除対象のイベントハンドラ登録を識別するトークンを指定する。
vtbl 21 HRESULT add_ScriptDialogOpening(ICoreWebView2ScriptDialogOpeningEventHandler* eventHandler, EventRegistrationToken* token)
eventHandlerICoreWebView2ScriptDialogOpeningEventHandler*inスクリプトダイアログ(alert/confirm 等)表示イベントを受け取るイベントハンドラへのポインタである。
tokenEventRegistrationToken*out登録したイベントハンドラを後で解除するためのトークンを受け取るポインタである。
vtbl 22 HRESULT remove_ScriptDialogOpening(EventRegistrationToken token)
tokenEventRegistrationTokenin解除対象のイベントハンドラ登録を識別するトークンを指定する。
vtbl 23 HRESULT add_PermissionRequested(ICoreWebView2PermissionRequestedEventHandler* eventHandler, EventRegistrationToken* token)
eventHandlerICoreWebView2PermissionRequestedEventHandler*in権限要求イベントを受け取るイベントハンドラへのポインタである。
tokenEventRegistrationToken*out登録したイベントハンドラを後で解除するためのトークンを受け取るポインタである。
vtbl 24 HRESULT remove_PermissionRequested(EventRegistrationToken token)
tokenEventRegistrationTokenin解除対象のイベントハンドラ登録を識別するトークンを指定する。
vtbl 25 HRESULT add_ProcessFailed(ICoreWebView2ProcessFailedEventHandler* eventHandler, EventRegistrationToken* token)
eventHandlerICoreWebView2ProcessFailedEventHandler*inブラウザプロセスの異常終了イベントを受け取るイベントハンドラへのポインタである。
tokenEventRegistrationToken*out登録したイベントハンドラを後で解除するためのトークンを受け取るポインタである。
vtbl 26 HRESULT remove_ProcessFailed(EventRegistrationToken token)
tokenEventRegistrationTokenin解除対象のイベントハンドラ登録を識別するトークンを指定する。
vtbl 27 HRESULT AddScriptToExecuteOnDocumentCreated(LPWSTR javaScript, ICoreWebView2AddScriptToExecuteOnDocumentCreatedCompletedHandler* handler)
javaScriptLPWSTRin各ドキュメント生成時に実行する JavaScript コードを指定する。
handlerICoreWebView2AddScriptToExecuteOnDocumentCreatedCompletedHandler*in登録完了を受け取る完了ハンドラへのポインタである。
vtbl 28 HRESULT RemoveScriptToExecuteOnDocumentCreated(LPWSTR id)
idLPWSTRin削除対象のスクリプトを識別する ID 文字列を指定する。
vtbl 29 HRESULT ExecuteScript(LPWSTR javaScript, ICoreWebView2ExecuteScriptCompletedHandler* handler)
javaScriptLPWSTRin現在のドキュメント内で実行する JavaScript コードを指定する。
handlerICoreWebView2ExecuteScriptCompletedHandler*in実行結果(JSON 文字列)を受け取る完了ハンドラへのポインタである。
vtbl 30 HRESULT CapturePreview(COREWEBVIEW2_CAPTURE_PREVIEW_IMAGE_FORMAT imageFormat, IStream* imageStream, ICoreWebView2CapturePreviewCompletedHandler* handler)
imageFormatCOREWEBVIEW2_CAPTURE_PREVIEW_IMAGE_FORMATin出力する画像の形式を示す COREWEBVIEW2_CAPTURE_PREVIEW_IMAGE_FORMAT 値を指定する。
imageStreamIStream*inキャプチャした画像データを書き込む出力先ストリーム(IStream)へのポインタである。
handlerICoreWebView2CapturePreviewCompletedHandler*inキャプチャ完了を受け取る完了ハンドラへのポインタである。
vtbl 31 HRESULT Reload( void)
voidin引数はない。
vtbl 32 HRESULT PostWebMessageAsJson(LPWSTR webMessageAsJson)
webMessageAsJsonLPWSTRinページ側スクリプトへ送信する Web メッセージを JSON 形式の文字列で指定する。
vtbl 33 HRESULT PostWebMessageAsString(LPWSTR webMessageAsString)
webMessageAsStringLPWSTRinページ側スクリプトへ送信する Web メッセージを文字列で指定する。
vtbl 34 HRESULT add_WebMessageReceived(ICoreWebView2WebMessageReceivedEventHandler* handler, EventRegistrationToken* token)
handlerICoreWebView2WebMessageReceivedEventHandler*inページ側からの Web メッセージ受信イベントを受け取るイベントハンドラへのポインタである。
tokenEventRegistrationToken*out登録したイベントハンドラを後で解除するためのトークンを受け取るポインタである。
vtbl 35 HRESULT remove_WebMessageReceived(EventRegistrationToken token)
tokenEventRegistrationTokenin解除対象のイベントハンドラ登録を識別するトークンを指定する。
vtbl 36 HRESULT CallDevToolsProtocolMethod(LPWSTR methodName, LPWSTR parametersAsJson, ICoreWebView2CallDevToolsProtocolMethodCompletedHandler* handler)
methodNameLPWSTRin呼び出す DevTools Protocol のメソッド名を指定する。
parametersAsJsonLPWSTRinメソッドへ渡すパラメータを JSON 形式の文字列で指定する。
handlerICoreWebView2CallDevToolsProtocolMethodCompletedHandler*in呼び出し結果を受け取る完了ハンドラへのポインタである。
vtbl 37 HRESULT get_BrowserProcessId(DWORD* value)
valueDWORD*outWebView をホストするブラウザプロセスの識別子を受け取るポインタである。
vtbl 38 HRESULT get_CanGoBack(BOOL* canGoBack)
canGoBackBOOL*out履歴を前(戻る)に移動できるかどうかを示す真偽値を受け取るポインタである。
vtbl 39 HRESULT get_CanGoForward(BOOL* canGoForward)
canGoForwardBOOL*out履歴を後(進む)に移動できるかどうかを示す真偽値を受け取るポインタである。
vtbl 40 HRESULT GoBack( void)
voidin引数はない。
vtbl 41 HRESULT GoForward( void)
voidin引数はない。
vtbl 42 HRESULT GetDevToolsProtocolEventReceiver(LPWSTR eventName, ICoreWebView2DevToolsProtocolEventReceiver** receiver)
eventNameLPWSTRin受信したい DevTools Protocol のイベント名を指定する。
receiverICoreWebView2DevToolsProtocolEventReceiver**out指定イベントの受信オブジェクト(ICoreWebView2DevToolsProtocolEventReceiver)を受け取るポインタである。
vtbl 43 HRESULT Stop( void)
voidin引数はない。
vtbl 44 HRESULT add_NewWindowRequested(ICoreWebView2NewWindowRequestedEventHandler* eventHandler, EventRegistrationToken* token)
eventHandlerICoreWebView2NewWindowRequestedEventHandler*in新しいウィンドウ要求イベントを受け取るイベントハンドラへのポインタである。
tokenEventRegistrationToken*out登録したイベントハンドラを後で解除するためのトークンを受け取るポインタである。
vtbl 45 HRESULT remove_NewWindowRequested(EventRegistrationToken token)
tokenEventRegistrationTokenin解除対象のイベントハンドラ登録を識別するトークンを指定する。
vtbl 46 HRESULT add_DocumentTitleChanged(ICoreWebView2DocumentTitleChangedEventHandler* eventHandler, EventRegistrationToken* token)
eventHandlerICoreWebView2DocumentTitleChangedEventHandler*inドキュメントタイトル変更イベントを受け取るイベントハンドラへのポインタである。
tokenEventRegistrationToken*out登録したイベントハンドラを後で解除するためのトークンを受け取るポインタである。
vtbl 47 HRESULT remove_DocumentTitleChanged(EventRegistrationToken token)
tokenEventRegistrationTokenin解除対象のイベントハンドラ登録を識別するトークンを指定する。
vtbl 48 HRESULT get_DocumentTitle(LPWSTR* title)
titleLPWSTR*out現在のドキュメントのタイトル文字列を受け取るポインタである。文字列は呼び出し側が解放する。
vtbl 49 HRESULT AddHostObjectToScript(LPWSTR name, VARIANT* object)
nameLPWSTRinページ側スクリプトから参照する際のホストオブジェクトの名前を指定する。
objectVARIANT*inスクリプトへ公開するホストオブジェクトを格納した VARIANT へのポインタである。
vtbl 50 HRESULT RemoveHostObjectFromScript(LPWSTR name)
nameLPWSTRinスクリプトへの公開を解除するホストオブジェクトの名前を指定する。
vtbl 51 HRESULT OpenDevToolsWindow( void)
voidin引数はない。
vtbl 52 HRESULT add_ContainsFullScreenElementChanged(ICoreWebView2ContainsFullScreenElementChangedEventHandler* eventHandler, EventRegistrationToken* token)
eventHandlerICoreWebView2ContainsFullScreenElementChangedEventHandler*in全画面要素の有無の変化イベントを受け取るイベントハンドラへのポインタである。
tokenEventRegistrationToken*out登録したイベントハンドラを後で解除するためのトークンを受け取るポインタである。
vtbl 53 HRESULT remove_ContainsFullScreenElementChanged(EventRegistrationToken token)
tokenEventRegistrationTokenin解除対象のイベントハンドラ登録を識別するトークンを指定する。
vtbl 54 HRESULT get_ContainsFullScreenElement(BOOL* containsFullScreenElement)
containsFullScreenElementBOOL*out全画面表示中の要素を含むかどうかを示す真偽値を受け取るポインタである。
vtbl 55 HRESULT add_WebResourceRequested(ICoreWebView2WebResourceRequestedEventHandler* eventHandler, EventRegistrationToken* token)
eventHandlerICoreWebView2WebResourceRequestedEventHandler*inWeb リソース要求イベントを受け取るイベントハンドラへのポインタである。
tokenEventRegistrationToken*out登録したイベントハンドラを後で解除するためのトークンを受け取るポインタである。
vtbl 56 HRESULT remove_WebResourceRequested(EventRegistrationToken token)
tokenEventRegistrationTokenin解除対象のイベントハンドラ登録を識別するトークンを指定する。
vtbl 57 HRESULT AddWebResourceRequestedFilter(LPWSTR uri, COREWEBVIEW2_WEB_RESOURCE_CONTEXT resourceContext)
uriLPWSTRinリソース要求イベントを発生させる対象 URI のフィルタパターンを指定する。
resourceContextCOREWEBVIEW2_WEB_RESOURCE_CONTEXTinフィルタ対象とするリソースの種類を示す COREWEBVIEW2_WEB_RESOURCE_CONTEXT 値を指定する。
vtbl 58 HRESULT RemoveWebResourceRequestedFilter(LPWSTR uri, COREWEBVIEW2_WEB_RESOURCE_CONTEXT resourceContext)
uriLPWSTRin削除するフィルタの対象 URI パターンを指定する。
resourceContextCOREWEBVIEW2_WEB_RESOURCE_CONTEXTin削除するフィルタのリソース種別を示す COREWEBVIEW2_WEB_RESOURCE_CONTEXT 値を指定する。
vtbl 59 HRESULT add_WindowCloseRequested(ICoreWebView2WindowCloseRequestedEventHandler* eventHandler, EventRegistrationToken* token)
eventHandlerICoreWebView2WindowCloseRequestedEventHandler*inウィンドウクローズ要求イベントを受け取るイベントハンドラへのポインタである。
tokenEventRegistrationToken*out登録したイベントハンドラを後で解除するためのトークンを受け取るポインタである。
vtbl 60 HRESULT remove_WindowCloseRequested(EventRegistrationToken token)
tokenEventRegistrationTokenin解除対象のイベントハンドラ登録を識別するトークンを指定する。

HSP用 COM定義

#usecom / #comfunc によるHSPのCOM呼び出し定義。数字は vtbl インデックス(0始まり)。WebView2 のインターフェースは環境/ローダ経由で取得するため #usecom 末尾は "{}"

出力引数:
#define global IID_ICoreWebView2 "{76ECEACB-0462-4D94-AC83-423A6793775E}"
#usecom global ICoreWebView2 IID_ICoreWebView2 "{}"
#comfunc global ICoreWebView2_get_Settings                             3 sptr
#comfunc global ICoreWebView2_get_Source                               4 var
#comfunc global ICoreWebView2_Navigate                                 5 wstr
#comfunc global ICoreWebView2_NavigateToString                         6 wstr
#comfunc global ICoreWebView2_add_NavigationStarting                   7 sptr,var
#comfunc global ICoreWebView2_remove_NavigationStarting                8 int
#comfunc global ICoreWebView2_add_ContentLoading                       9 sptr,var
#comfunc global ICoreWebView2_remove_ContentLoading                    10 int
#comfunc global ICoreWebView2_add_SourceChanged                        11 sptr,var
#comfunc global ICoreWebView2_remove_SourceChanged                     12 int
#comfunc global ICoreWebView2_add_HistoryChanged                       13 sptr,var
#comfunc global ICoreWebView2_remove_HistoryChanged                    14 int
#comfunc global ICoreWebView2_add_NavigationCompleted                  15 sptr,var
#comfunc global ICoreWebView2_remove_NavigationCompleted               16 int
#comfunc global ICoreWebView2_add_FrameNavigationStarting              17 sptr,var
#comfunc global ICoreWebView2_remove_FrameNavigationStarting           18 int
#comfunc global ICoreWebView2_add_FrameNavigationCompleted             19 sptr,var
#comfunc global ICoreWebView2_remove_FrameNavigationCompleted          20 int
#comfunc global ICoreWebView2_add_ScriptDialogOpening                  21 sptr,var
#comfunc global ICoreWebView2_remove_ScriptDialogOpening               22 int
#comfunc global ICoreWebView2_add_PermissionRequested                  23 sptr,var
#comfunc global ICoreWebView2_remove_PermissionRequested               24 int
#comfunc global ICoreWebView2_add_ProcessFailed                        25 sptr,var
#comfunc global ICoreWebView2_remove_ProcessFailed                     26 int
#comfunc global ICoreWebView2_AddScriptToExecuteOnDocumentCreated      27 wstr,sptr
#comfunc global ICoreWebView2_RemoveScriptToExecuteOnDocumentCreated   28 wstr
#comfunc global ICoreWebView2_ExecuteScript                            29 wstr,sptr
#comfunc global ICoreWebView2_CapturePreview                           30 int,sptr,sptr
#comfunc global ICoreWebView2_Reload                                   31 int
#comfunc global ICoreWebView2_PostWebMessageAsJson                     32 wstr
#comfunc global ICoreWebView2_PostWebMessageAsString                   33 wstr
#comfunc global ICoreWebView2_add_WebMessageReceived                   34 sptr,var
#comfunc global ICoreWebView2_remove_WebMessageReceived                35 int
#comfunc global ICoreWebView2_CallDevToolsProtocolMethod               36 wstr,wstr,sptr
#comfunc global ICoreWebView2_get_BrowserProcessId                     37 var
#comfunc global ICoreWebView2_get_CanGoBack                            38 var
#comfunc global ICoreWebView2_get_CanGoForward                         39 var
#comfunc global ICoreWebView2_GoBack                                   40 int
#comfunc global ICoreWebView2_GoForward                                41 int
#comfunc global ICoreWebView2_GetDevToolsProtocolEventReceiver         42 wstr,sptr
#comfunc global ICoreWebView2_Stop                                     43 int
#comfunc global ICoreWebView2_add_NewWindowRequested                   44 sptr,var
#comfunc global ICoreWebView2_remove_NewWindowRequested                45 int
#comfunc global ICoreWebView2_add_DocumentTitleChanged                 46 sptr,var
#comfunc global ICoreWebView2_remove_DocumentTitleChanged              47 int
#comfunc global ICoreWebView2_get_DocumentTitle                        48 var
#comfunc global ICoreWebView2_AddHostObjectToScript                    49 wstr,var
#comfunc global ICoreWebView2_RemoveHostObjectFromScript               50 wstr
#comfunc global ICoreWebView2_OpenDevToolsWindow                       51 int
#comfunc global ICoreWebView2_add_ContainsFullScreenElementChanged     52 sptr,var
#comfunc global ICoreWebView2_remove_ContainsFullScreenElementChanged  53 int
#comfunc global ICoreWebView2_get_ContainsFullScreenElement            54 var
#comfunc global ICoreWebView2_add_WebResourceRequested                 55 sptr,var
#comfunc global ICoreWebView2_remove_WebResourceRequested              56 int
#comfunc global ICoreWebView2_AddWebResourceRequestedFilter            57 wstr,int
#comfunc global ICoreWebView2_RemoveWebResourceRequestedFilter         58 wstr,int
#comfunc global ICoreWebView2_add_WindowCloseRequested                 59 sptr,var
#comfunc global ICoreWebView2_remove_WindowCloseRequested              60 int
; ※数字は vtbl インデックス(0始まり)。0/1/2 は IUnknown(QueryInterface/AddRef/Release)。
; ※このインターフェースは直接 CoCreateInstance するクラスIDが無いため "{}"(他メソッド/アクティベーションで取得)。
; ※出力/バッファ引数は var(変数直渡し)。varptr 方式にも切替可。
; ※ハンドル/void*等の不透明ポインタは IronHSP では intptr 指定が可能。

関連項目

バージョン違い・関連インターフェース