How to catch closing event if user is closing the app by closing terminal (Winforms)? - winforms

I have a Winforms app and usually when a user runs an app the UI of the app visible only, but if you set in settings open as Console app, as a result, each time when the app will be opened the terminal will be opened as well (BTW I need this option to be enabled in my case).
Problem is that I have a logic in Closing form event and it works well if a user closes the app by clicking on the cross at the top of the app window, but if they close the app by click cross on the terminal window the app doesn't get any closing events. It just terminates the app process.
So, the question is - is there a way to catch the closing event if the user tries to close the app through the closing terminal instead of closing the app?

Related

HTML input type=“file” in iframe breaks the file select dialog in Chrome and Edge

I'm working on a React web app that has an iframe component to embed another web app. The parent app has functions to open or close (unmount) the iframe component. And the parent app uses real-time data subscription and it has the behavior to automatically close the iframe when it got a specific event. So it means that the iframe can be closed anytime.
Now onto the problem, both of the apps have input type="file" to upload file. If the iframe got unmounted while I have a "file select dialog" opened from within the iframe, the dialog would still be displayed unless I click the "cancel" button. But the thing is, after closing the file dialog and click Choose File in another input type="file", the file dialog will never show up again unless I refresh the page.
For more info:
the bug won't happen if I run any of the parent or iframe app in localhost, it only happen on the deployed site
Both of the apps is from same domain but with different pathname (ex. https://hello.com/parent and https://hello.com/iframe)
I'm not sure if this is a Chromium bug because it happens in Google Chrome and MS Edge, but not in Safari and Firefox.

How to get PWA desktop application hardware close button click event?

I have created Progressive-web-app for Desktop, i want to get close event of hardware close button, it is possible to get.
while closing app from windows default close button (near to Restore
down and Minimize - top right corner), i want to call logout function.

Create Browser control in a popup window without it stealing focus

We are building a custom web browser using CefSharp WinForms (version 71.0.2.0) and need to open a popup form containing a browser control. This popup must not steal focus from any other window the user has open (the current app and any others they are working in) but must pop up in front of any others.
We have successfully managed this in a previous version of the application which used a different Chrome wrapper.
Whatever I try I cannot get it to work.
Using the following:
frm.Visible = false;
frm.TopMost = false;
ShowWindow(frm.Handle, SW_SHOWNOACTIVATE);
SetWindowPos((int)frm.Handle, HWND_TOPMOST,frm.Left, frm.Top, frm.Width, frm.Height,SWP_NOACTIVATE);
frm.Visible = true; //So that Load event happens
shows an inactive window if I don't include a browser on it, when I add a browser window and call the above it steals focus.

How to avoid blocking new window popup in AngularJS

I've an issue on opening new page window in my Angular JS project if popup is being blocked.
Do you have any solution on bypass popup/new window blocking in IE > 8
Note; It's not a button click event to open new window.
If you are referring to the window popup using window.open() you can't specially if the user has blocked popup's from their browser that popups blocked icon at the rightmost part of the url bar or in the browser settings then you can't do anything about it.

Codename one ,how to kill web browser instance after close form

i have webpage in my form when i close form and reopen it the web page say :
this page is already in progress from this browser instance. plz Close
the old instance.
how to close all browser instance when i close the form
BR,
You can invoke destroy() on the browser component.

Resources