Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Windows.h>
- using namespace Windows::ApplicationModel::Activation;
- using namespace Windows::Foundation;
- using namespace Windows::UI::Core;
- using namespace Windows::UI::Xaml;
- using namespace Windows::UI::Xaml::Controls;
- ref struct MainPage sealed : Page
- {
- MainPage()
- {
- OutputDebugStringA("MainPage\n");
- }
- private:
- ~MainPage()
- {
- OutputDebugStringA("~MainPage\n");
- }
- };
- ref struct App sealed : Application
- {
- void OnLaunched(LaunchActivatedEventArgs^) override
- {
- Window^ window = Window::Current;
- window->Content = ref new MainPage; // MainPage is called.
- window->CoreWindow->PointerPressed += ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>([](auto&&...)
- {
- Window::Current->Content = nullptr; // ~MainPage is NOT called.
- });
- window->Activate();
- }
- };
- int main(Platform::Array<Platform::String^>^ args)
- {
- Application::Start(ref new ApplicationInitializationCallback([](auto &&) { ref new App; }));
- }
Add Comment
Please, Sign In to add comment