I am writing a add-in for outlook. I want to ask password before inactivating the add-in. if password is not correct, Add-in shouldn't be inactive. While inactiving add-in it is firing "ThisAddIn_Shutdown" event but I can't block inactiving add-in.
This is my code:
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
var frm = new FrmCheck();
var result = frm.ShowDialog();
if (frm.Statu==WinStatu.Close && result == DialogResult.OK)
{
//password is correct. Close Add-in
}
else
{
//TODO: cancel closing this add-in
MessageBox.Show("You can't close this add-in, please enter valid password.");
}
}
Thanks.
You don't have any control over a user disabling an add-in - your best bet is to probably have a separate process/service that re-enables it as necessary. (It's just a case of editing the registry key that controls load behavior)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.