Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > User Interface Editor for Uninstall?
 

User Interface Editor for Uninstall?

The user interface editor only allows you to edit for the install process. Is there any way to ask the user a question during uninstall? Basically I want to ask the user if they want to delete the database, and if so it deletes it for them. I'm doing it now with a custom uninstall action and a MessageBox, but for some reason and only some of the time it pops up underneath the uninstall window and is easy not to notice. Any ideas?
ScottyDoesKnow  Monday, July 27, 2009 7:50 PM
Windows uninstalls a product with reduced UI, so there's no practical way to change that. The supported way to interact with Windows Installer isn't with a MessageBox, it's with the MsiProcessMessage Win32 API that knows how to deal with messages and windows in these situations.
Phil Wilson
PhilWilson  Tuesday, July 28, 2009 7:13 PM
Can you give me some more information on it? The documentation is really lacking. I'm trying to do this in C#.

I guess what I should ask first is is it possible to ask the user a yes/no question using MsiProcessMessage? I don't see how I'd pass a string in to ask.

If I can use this, here's what I've figured out so far.

1. Use MsiOpenProduct to get my MSIHANDLE.
2. Use MsiProcessMessage and get response (Just have to figure out enum values, and what is the second MSIHANDLE for?)
3. Use MsiCloseHandle

I can DllImport all three functions, but I need to import MSIHANDLE too and there doesn't seem to be any documentation on it.

Thanks for the help.
ScottyDoesKnow  Wednesday, July 29, 2009 2:37 PM
Anybody know more about using MsiProcessMessage? And moderators setting the question to answered when it is obviously not answered is starting to get annoying.
ScottyDoesKnow  Thursday, August 27, 2009 3:20 PM
You can't do this in C#. You need a C++ uninstall custom action that has code something like this:

PMSIHANDLE hRec = MsiCreateRecord(2);
MsiRecordSetString(hRec,0,"your message");
UINT uiRet = MsiProcessMessage(hInstall,INSTALLMESSAGE(INSTALLMESSAGE_USER |dwOptions),hRec);

The first handle is the one that Windows gives you asa C++ custom action parameter, the second is the handle from creating a record containing the message. MSI is nothing to do with C# or .NET. It's a Win32 framework that Visual Studio adds some help to for calling .NET code.

I don't know why you're doing this anyway. The standard rule is that user-created data stays behind, so just leave it behind. If I uninstalled Word it wouldn't be asking me about uninstalling all my Word documents.

Phil Wilson
PhilWilson  Thursday, August 27, 2009 11:33 PM

You can use google to search for other answers

Custom Search

More Threads

• VSTO 2005 Outlook Addin deploy question
• How to verify that moss is installed on the machine?
• Error installing VB applications (temporary profile user error)
• windows installer
• Modify registry from an installer(MSI)
• Is it possible to redirect I/O from a clickonce console app?
• how to install prerequisities with application?
• VSTO Installer Stopped Working
• Open .exe from network
• ClickOnce ... endless frustrations