Recently I have had to deal with things breaking in a VBA program. It is not in Excel or anything Office but in another environment. To strengthen security Microsoft keeps breaking commonly used dialogs and other ActiveX controls used by VBA.
Mostly now I work in C#/WPF. I want to make some of the controls and dialogs in WPF. I can pass parameters from VBA to WPF with no problem. How can I make a WPF app that will return a value.
I suspect that somewhere there is a good example of something like this. Probably done 5 to 10 years ago. I have tried many different search keys over the last couple of weeks but cannot seem to find one.
解决方案Add a handler for the Application.Exit.
Then in the handler:
private void Application_Exit(object sender, ExitEventArgs e)
{
e.ApplicationExitCode = 99;
}
where 99 is the code you want to return.