0

I have a wix bundle for testing that calls a Windows MFC dialog-based application (an EXE file.) As that application has "Cancel" button, when the user clicks it, I want to make the bundle fail intentionally. How can I do it?

Here is an excerpt from my app and I use PostQuitMessage(1603) but it doesn't work.

BOOL CBundleUtilApp::InitInstance()
{
...
    m_pMainWnd = &dlg;
    INT_PTR nResponse = dlg.DoModal();
    ...
    if( nResponse == IDCANCEL )
    {
        PostQuitMessage( 1603 );
    }

    m_pMainWnd = NULL;

    return FALSE;
}   // InitInstance()
Petronius
  • 428
  • 4
  • 12
  • Possible duplicate of [What is the correct way to programmatically quit an MFC application?](https://stackoverflow.com/questions/7562335/what-is-the-correct-way-to-programmatically-quit-an-mfc-application) – Andrew Truckle Jul 01 '19 at 22:39
  • Hi @Andrew, No, it isn't. The bundle app (aka bootstrapper) doesn't know and proceeds to the next item in the chain. – Petronius Jul 02 '19 at 13:46
  • Override `CWinApp::ExitInstance()` to return the exit code you want. – zett42 Jul 02 '19 at 20:12
  • Hi @zett42, That's it. After I did what you said, now the bootstrapper know it failed. Thank you. – Petronius Jul 03 '19 at 11:10

0 Answers0