Return to Snippet

Revision: 11787
at February 18, 2009 12:49 by jimfred


Initial Code
BOOL MyDlg::OnMenuUninstall( UINT nID )
{
   // WinExec is obsolete.

   ShellExecute(
      NULL,            // hwnd
      "open",          // operation/verb.
      "MsiExec.exe",   // executable.
      "/x{FEF094C3-B58A-42e5-8170-659A670B25E6}", // parameters.
      "",              // directory
      SW_SHOW );       // how to be displayed 

   // GUID comes from setup.vdproj file. Search for...
   //        "ProductName" = "8:DCT Upgrade"
   //        "ProductCode" = "8:{FEF094C3-B58A-42e5-8170-659A670B25E6}"
   return TRUE; 
}

Initial URL
mfc uninstall

Initial Description
Add self-uninstall ability to MFC application by calling ShellExecute for MsiExec.exe.
Useful for temporary apps that can be uninstalled after use.
The installation's GUID is required. This GUID is auto-created by Visual Studio when a Setup/installation project is created.

Initial Title
Add self-uninstall ability to MFC application by calling ShellExecute for MsiExec.exe

Initial Tags


Initial Language
C++