BOOL AP_Win32Dialog_New::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
	WORD wId = LOWORD(wParam);

	switch (wId)
	{
	case IDCANCEL:						// also AP_RID_DIALOG_NEW_BTN_CANCEL
		setAnswer (AP_Dialog_New::a_CANCEL);
		EndDialog(hWnd,0);
		return 1;

	case IDOK:							// also AP_RID_DIALOG_NEW_BTN_OK
		setAnswer (AP_Dialog_New::a_OK);
		EndDialog(hWnd,0);
		return 1;

	case AP_RID_DIALOG_NEW_LBX_TEMPLATE:
		switch (HIWORD(wParam))
		{
		case LBN_SELCHANGE:
			UT_sint32 nIndex = _win32Dialog.getListSelectedIndex(wId);
			_setFileName( nIndex );
			return 1;
		}
		return 0;

	case AP_RID_DIALOG_NEW_BTN_EXISTING:
		_doChoose();
		return 1;

	case AP_RID_DIALOG_NEW_RDO_TEMPLATE:
		setOpenType(AP_Dialog_New::open_Template);
		{
			int nIndex = _win32Dialog.getListSelectedIndex(AP_RID_DIALOG_NEW_LBX_TEMPLATE);
			if( nIndex == LB_ERR )
			{
				HWND hControl = GetDlgItem(hWnd, AP_RID_DIALOG_NEW_LBX_TEMPLATE);
				nIndex = SendMessageW( hControl, LB_FINDSTRING , (WPARAM) -1, (LPARAM) "Normal" );
				_win32Dialog.selectListItem(AP_RID_DIALOG_NEW_LBX_TEMPLATE, nIndex);
				_setFileName( nIndex );
			}
		}
		_updateControls();
		return 1;

	case AP_RID_DIALOG_NEW_RDO_EXISTING:
		setOpenType(AP_Dialog_New::open_Existing);
		_updateControls();
		return 1;

	default:							// we did not handle this notification
		UT_DEBUGMSG(("WM_Command for id %ld\n",wId));
		return 0;						// return zero to let windows take care of it.
	}
}
 void HttpRequestTask::setFileName(const std::string& name)
 {
     _fname = name;
     _setFileName(name);
 }