A prompt impl snippet << Previous |  Contents  |  Next >>  ]
A prompt impl snippet Implemented by you and provides methods for...
  • Prompt & Confirm dialogs (with checkbox variants)
  • ConfirmEx for greater control
  • List box selection

  #include "nsIPromptService.h"
  ...
  NS_IMETHODIMP CPromptService::Confirm(nsIDOMWindow *parent,
                                        const PRUnichar *dialogTitle,
                                        const PRUnichar *text,
                                        PRBool *_retval)
  {
    CWnd *wnd = CWndForDOMWindow(parent);
    int choice = PR_FALSE;
    if (wnd)
      choice = wnd->MessageBox(W2T(text), W2T(dialogTitle),
                      MB_YESNO | MB_ICONEXCLAMATION);

    *_retval = choice == IDYES ? PR_TRUE : PR_FALSE;
    return NS_OK;
  }