Skip to content

Commit 8906b19

Browse files
authored
Stwhi main/updating code (#3800)
* updating code * tidying up code * tidying up code 2 * tidying up code 3
1 parent 7a9d421 commit 8906b19

File tree

6 files changed

+7
-10
lines changed

6 files changed

+7
-10
lines changed

hub/apps/design/shell/tiles-and-notifications/secondary-tiles-desktop-pinning.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ If you're using WPF or WinForms, and you haven't packaged your app with the Desk
144144
1. Retrieve a window handle, and initialize the secondary tile object with that handle. In the code below, `this` is a pointer to a [WinUI 3 Window](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.window) object. For more info, see [Retrieve a window handle (HWND)](../../../develop/ui-input/retrieve-hwnd.md) and [Display WinRT UI objects that depend on CoreWindow](../../../develop/ui-input/display-ui-objects.md).
145145

146146
```cppwinrt
147-
auto windowNative{ this->try_as<::IWindowNative>() };
148-
winrt::check_bool(windowNative);
147+
auto windowNative{ this->m_inner.as<::IWindowNative>() };
149148
HWND hWnd{ 0 };
150149
windowNative->get_WindowHandle(&hWnd);
151150

hub/apps/develop/ui-input/display-ui-objects.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ public sealed partial class MainWindow : Window
174174
void MainWindow::myButton_Click(IInspectable const&, RoutedEventArgs const&)
175175
{
176176
// Retrieve the window handle (HWND) of the current WinUI 3 window.
177-
auto windowNative{ this->try_as<::IWindowNative>() };
178-
winrt::check_bool(windowNative);
177+
auto windowNative{ this->m_inner.as<::IWindowNative>() };
179178
HWND hWnd{ 0 };
180179
windowNative->get_WindowHandle(&hWnd);
181180

hub/apps/develop/ui-input/retrieve-hwnd.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ The C++/WinRT code below shows how to retrieve the window handle (HWND) for a Wi
4343
void MainWindow::myButton_Click(IInspectable const&, RoutedEventArgs const&)
4444
{
4545
// Retrieve the window handle (HWND) of the current WinUI 3 window.
46-
auto windowNative{ this->try_as<::IWindowNative>() };
47-
winrt::check_bool(windowNative);
46+
auto windowNative{ this->m_inner.as<::IWindowNative>() };
4847
HWND hWnd{ 0 };
4948
windowNative->get_WindowHandle(&hWnd);
5049
}

hub/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/winui3.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,9 @@ await showDialog.ShowAsync();
133133
...
134134
auto showDialog{ Windows::UI::Popups::MessageDialog(L"Message here") };
135135
136+
auto windowNative{ this->m_inner.as<::IWindowNative>() };
136137
HWND hWnd{ 0 };
137-
this->try_as<::IWindowNative>()->get_WindowHandle(&hWnd);
138+
windowNative->get_WindowHandle(&hWnd);
138139
showDialog.as<::IInitializeWithWindow>()->Initialize(hWnd);
139140
140141
co_await showDialog.ShowAsync();

hub/apps/windows-app-sdk/system-backdrop-controller.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ struct MainWindow : MainWindowT<MainWindow>
422422
m_backdropController = winrt::MUCSB::MicaController();
423423
m_backdropController.SetSystemBackdropConfiguration(m_configuration);
424424
m_backdropController.AddSystemBackdropTarget(
425-
this->try_as<winrt::MUC::ICompositionSupportsSystemBackdrop>());
425+
this->m_inner.as<winrt::MUC::ICompositionSupportsSystemBackdrop>());
426426
}
427427
else
428428
{

hub/apps/windows-app-sdk/windowing/windowing-overview.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ private void myButton_Click(object sender, RoutedEventArgs e)
119119
void MainWindow::myButton_Click(IInspectable const&, RoutedEventArgs const&)
120120
{
121121
// Retrieve the window handle (HWND) of the current (XAML) WinUI 3 window.
122-
auto windowNative{ this->try_as<::IWindowNative>() };
123-
winrt::check_bool(windowNative);
122+
auto windowNative{ this->m_inner.as<::IWindowNative>() };
124123
HWND hWnd{ 0 };
125124
windowNative->get_WindowHandle(&hWnd);
126125

0 commit comments

Comments
 (0)