![]() ![]() The C# code below shows how to retrieve the window handle (HWND) for a WPF window object. Void MainWindow::myButton_Click(IInspectable const&, RoutedEventArgs const&) This example calls the IWindowNative::get_WindowHandle method. The C++/WinRT code below shows how to retrieve the window handle (HWND) for a WinUI 3 Window object. Retrieve the window handle (HWND) of the current WinUI 3 window. Private async void myButton_Click(object sender, RoutedEventArgs e) ![]() ![]() For more info about the C# interop classes, see Call interop APIs from a. This example calls the GetWindowHandle method on the C# interop class. The C# code below shows how to retrieve the window handle (HWND) for a WinUI 3 Window object. For more info, see Display WinRT UI objects that depend on CoreWindow. One example is to use the HWND to interoperate with certain Windows Runtime (WinRT) objects that depend on a CoreWindow to display a user-interface (UI). There are several reasons to retrieve the HWND for a window in your WinUI 3, WPF, or WinForms desktop app. In any case, you'll hear the term HWND used as a shorthand for window handle. And the type of a window handle is an HWND (although it surfaces in C# as an IntPtr). In Win32, a window object is identified by a value known as a window handle. The development and UI frameworks listed above are (behind the scenes) built on the Win32 API. The scope covers Windows UI Library (WinUI) 3, Windows Presentation Foundation (WPF), and Windows Forms (WinForms) apps code examples are presented in C# and C++/WinRT. This topic shows you how, in a desktop app, to retrieve the window handle for a window. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |