Added VarMonthName() implementation.

This commit is contained in:
Marcus Meissner 2005-05-29 20:17:30 +00:00 committed by Alexandre Julliard
parent d1a55eb3f8
commit e2511e195e
2 changed files with 55 additions and 1 deletions

View File

@ -126,7 +126,7 @@
126 stdcall VarBoolFromDisp(ptr long ptr) 126 stdcall VarBoolFromDisp(ptr long ptr)
127 stdcall VarFormatCurrency(ptr long long long long long ptr) 127 stdcall VarFormatCurrency(ptr long long long long long ptr)
128 stub VarWeekdayName # stdcall (long long long long ptr) 128 stub VarWeekdayName # stdcall (long long long long ptr)
129 stub VarMonthName # stdcall (long long long ptr) 129 stdcall VarMonthName(long long long ptr)
130 stdcall VarUI1FromI2(long ptr) 130 stdcall VarUI1FromI2(long ptr)
131 stdcall VarUI1FromI4(long ptr) 131 stdcall VarUI1FromI4(long ptr)
132 stdcall VarUI1FromR4(long ptr) 132 stdcall VarUI1FromR4(long ptr)

View File

@ -2405,3 +2405,57 @@ HRESULT WINAPI VarFormatCurrency(LPVARIANT pVarIn, INT nDigits, INT nLeading,
} }
return hRet; return hRet;
} }
/**********************************************************************
* VarMonthName [OLEAUT32.129]
*
* Print the specified month as localized name.
*
* PARAMS
* iMonth [I] month number 1..12
* fAbbrev [I] 0 - full name, !0 - abbreviated name
* dwFlags [I] flag stuff. only VAR_CALENDAR_HIJRI possible.
* pbstrOut [O] Destination for month name
*
* RETURNS
* Success: S_OK. pbstrOut contains the name.
* Failure: E_INVALIDARG, if any parameter is invalid.
* E_OUTOFMEMORY, if enough memory cannot be allocated.
*/
HRESULT WINAPI VarMonthName(INT iMonth, INT fAbbrev, ULONG dwFlags, BSTR *pbstrOut)
{
DWORD localeValue;
INT size;
WCHAR *str;
if ((iMonth < 1) || (iMonth > 12))
return E_INVALIDARG;
if (dwFlags)
FIXME("Does not support dwFlags 0x%lx, ignoring.\n", dwFlags);
if (fAbbrev)
localeValue = LOCALE_SABBREVMONTHNAME1 + iMonth - 1;
else
localeValue = LOCALE_SMONTHNAME1 + iMonth - 1;
size = GetLocaleInfoW(LOCALE_USER_DEFAULT,localeValue, NULL, 0);
if (!size) {
FIXME("GetLocaleInfo 0x%lx failed.\n", localeValue);
return E_INVALIDARG;
}
str = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*size);
if (!str)
return E_OUTOFMEMORY;
size = GetLocaleInfoW(LOCALE_USER_DEFAULT,localeValue, str, size);
if (!size) {
FIXME("GetLocaleInfo of 0x%lx failed in 2nd stage?!\n", localeValue);
HeapFree(GetProcessHeap(),0,str);
return E_INVALIDARG;
}
*pbstrOut = SysAllocString(str);
HeapFree(GetProcessHeap(),0,str);
if (!*pbstrOut)
return E_OUTOFMEMORY;
return S_OK;
}