interface ICoreWebView2_12
interface ICoreWebView2_12
: public ICoreWebView2_11
This interface is an extension of ICoreWebView2_11 that supports StatusBarTextChanged event.
Summary
Members | Descriptions |
---|---|
add_StatusBarTextChanged | Add an event handler for the StatusBarTextChanged event. |
get_StatusBarText | The status message text. |
remove_StatusBarTextChanged | Remove an event handler previously added with add_StatusBarTextChanged . |
Applies to
Product | Introduced |
---|---|
WebView2 Win32 | 1.0.1185.39 |
WebView2 Win32 Prerelease | 1.0.1189 |
Members
add_StatusBarTextChanged
Add an event handler for the StatusBarTextChanged
event.
public HRESULT add_StatusBarTextChanged(ICoreWebView2StatusBarTextChangedEventHandler * eventHandler, EventRegistrationToken * token)
StatusBarTextChanged
fires when the WebView is showing a status message, a URL, or an empty string (an indication to hide the status bar).
m_statusBar.Initialize(appWindow);
// Registering a listener for status bar message changes
CHECK_FAILURE(m_webView2_12->add_StatusBarTextChanged(
Microsoft::WRL::Callback<ICoreWebView2StatusBarTextChangedEventHandler>(
[this](ICoreWebView2* sender, IUnknown* args) -> HRESULT
{
if (m_customStatusBar)
{
wil::unique_cotaskmem_string value;
Microsoft::WRL::ComPtr<ICoreWebView2_12> wv;
CHECK_FAILURE(sender->QueryInterface(IID_PPV_ARGS(&wv)));
CHECK_FAILURE(wv->get_StatusBarText(&value));
std::wstring valueString = value.get();
if (valueString.length() != 0)
{
m_statusBar.Show(valueString);
}
else
{
m_statusBar.Hide();
}
}
return S_OK;
})
.Get(),
&m_statusBarTextChangedToken));
get_StatusBarText
The status message text.
public HRESULT get_StatusBarText(LPWSTR * value)
The caller must free the returned string with CoTaskMemFree
. See API Conventions.
remove_StatusBarTextChanged
Remove an event handler previously added with add_StatusBarTextChanged
.
public HRESULT remove_StatusBarTextChanged(EventRegistrationToken token)
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour