Application.OnLaunched(LaunchActivatedEventArgs) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Invoked when the application is launched. Override this method to perform application initialization and to create a new window.
protected:
virtual void OnLaunched(LaunchActivatedEventArgs ^ args) = OnLaunched;
void OnLaunched(LaunchActivatedEventArgs const& args);
protected virtual void OnLaunched(LaunchActivatedEventArgs args);
function onLaunched(args)
Protected Overridable Sub OnLaunched (args As LaunchActivatedEventArgs)
Parameters
Examples
Use OnLaunched
to create and activate the main window. (This code is provided by the Visual Studio project templates when you create a WinUI 3 app.)
private Window m_window;
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
m_window = new MainWindow();
m_window.Activate();
}