nsIPrompt and snippet [ << Previous | Contents | Next >> ]
Implemented by you and provides methods for...
  • Alert/Confirm (with checkbox options)
  • List box selection
  • ConfirmEx() - customized dialogs

  NS_IMETHODIMP CPromptService::Confirm(nsIDOMWindow *parent, 
                                        const PRUnichar *dialogTitle,
                                        const PRUnichar *text, 
					PRBool *_retval)
  {
    CWnd *wnd = CWndForDOMWindow(parent);
    int choice;

    if (wnd)
      choice = wnd->MessageBox(W2T(text), W2T(dialogTitle),
                      MB_YESNO | MB_ICONEXCLAMATION);
    else
      choice = ::MessageBox(0, W2T(text), W2T(dialogTitle),
                      MB_YESNO | MB_ICONEXCLAMATION);

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