Hi Frnds,
In the below mentioned code , GetTimeFormat is failing .Sometimes I am
getting the correct time but some times It is dumping the buffer with junk
some times . This error is not always reproducing . Only once in 3 to 4 times
this error is coming up . Even I tried by keeping 0 as last paramenetr to get
the length and then keeping that integer in the next call . Then also I am
getting the same error .
So the alternative I thought is to use GetLocalTime(&sysTime) , but
strucked up in calculating AM or PM . Please help me for this error .
CTitleBar::UpdateDateTime(
BOOL fUpdateDate, //default FALSE
LPCWSTR szTimeFormat //default NULL
)
{
ENTER_FUNCTION_EX_STATIC
LOG((RTC_TRACE, ("%s: Enter - Not implemented"), __fxName));
SYSTEMTIME sysTime = {0};
SYSTEMTIME loctime = {0};
TCHAR szBuffer[MAX_PATH] = _T("");
DWORD dwFlag = 0;
///TIME_ZONE_INFORMATION tzi;
GetLocalTime(&sysTime);
//GetTimeZoneInformation(&tzi);
if(szTimeFormat)
{
m_strTimeFormat = szTimeFormat;
}
//ARRAYSIZE(szBuffer)
GetTimeFormat(
::GetUserDefaultLCID(),
TIME_NOSECONDS,
NULL,
m_strTimeFormat,
szBuffer,
ARRAYSIZE(szBuffer)
);
m_LblTime.SetWindowText(szBuffer);
if((fUpdateDate) || (sysTime.wDay != m_nCurrentDay))
{
m_nCurrentDay = sysTime.wDay;
CString strDateFormat = L"ddd, MM/dd";
if(strDateFormat.IsEmpty())
{
dwFlag = DATE_SHORTDATE;
}
GetDateFormat(
::GetUserDefaultLCID(),
dwFlag,
NULL,
strDateFormat,
szBuffer,
ARRAYSIZE(szBuffer)
);
m_LblDate.SetWindowText(szBuffer);
}
//szBuffer = _T("");
LOG((RTC_TRACE, ("%s: Exit"), __fxName));
}
Get the freedom to save as many mails as you wish. To know how, go to
http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html
[Non-text portions of this message have been removed]