StDialogHandler	theHandler(dlog_Prompt, GetParentCommander(parent));
StDialogHandler	theHandler(dlog_Prompt, CBrowserChrome::GetLWindowForDOMWindow(parent));
NS_IMETHODIMP CPromptService::Prompt(nsIDOMWindow *parent, const PRUnichar *dialogTitle,                                     const PRUnichar *text, PRUnichar **value,                                     const PRUnichar *checkMsg, PRBool *checkValue,                                     PRBool *_retval){    NS_ENSURE_ARG_POINTER(_retval);    nsresult resultErr = NS_OK;    StDialogHandler	theHandler(dlog_Prompt, GetParentCommander(parent));    LWindow			 *theDialog = theHandler.GetDialog();    LCheckBox        *checkbox = dynamic_cast<LCheckBox*>(theDialog->FindPaneByID('Chck'));    nsCAutoString   cStr;    Str255          pStr;    if (dialogTitle) {        CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(dialogTitle), pStr);        theDialog->SetDescriptor(pStr);    }    LStaticText	*msgText = dynamic_cast<LStaticText*>(theDialog->FindPaneByID('Msg '));    CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(text), cStr);    cStr.ReplaceChar('\n', '\r');    msgText->SetText(const_cast<char *>(cStr.get()), cStr.Length());        LEditText *responseText = dynamic_cast<LEditText*>(theDialog->FindPaneByID('Rslt'));    if (value && *value) {        CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(*value), pStr);        responseText->SetDescriptor(pStr);    }        if (checkValue) {        checkbox->SetValue(*checkValue);        if (checkMsg) {            CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(checkMsg), pStr);            checkbox->SetDescriptor(pStr);        }    }    else        checkbox->Hide();    theDialog->SetLatentSub(responseText);        theDialog->Show();    theDialog->Select();		while (true)  // This is our modal dialog event loop	{						MessageT	hitMessage = theHandler.DoDialog();				if (hitMessage == msg_OK)		{		    nsAutoString ucStr;		    *_retval = PR_TRUE;		    if (value && *value) {		        nsMemory::Free(*value);		        *value = nsnull;		    }		    responseText->GetDescriptor(pStr);		    CPlatformUCSConversion::GetInstance()->PlatformToUCS(pStr, ucStr);		    *value = ToNewUnicode(ucStr);       		    if (*value == nsnull)   		        resultErr = NS_ERROR_OUT_OF_MEMORY;   		           		    if (checkValue)   		        *checkValue = checkbox->GetValue();   		           		    break;   		}   		else if (hitMessage == msg_Cancel)   		{   		    *_retval = PR_FALSE;   		    break;   		}	}    return resultErr;}