I have adjusted the first day of week at Region and Local settings in a control panel (Windows 7), and now I'm writing a C++ function that must returns the first day of week which I have adjusted. Any Windows API or standard c++ function that I can use it ?
Thanks

(Sorry what I had written was totally wrong. I have updated the post.)
The right function to use is EnumCalendarInfoExEx:
#include <Windows.h>
#include <strsafe.h>
#include <iostream>
using namespace std;
BOOL CALLBACK EnumCalendarInfoProcExEx(LPWSTR lpszInfo, CALID calendar, LPWSTR lpReserved, LPARAM lParam)
{
StringCchCopy(reinterpret_cast<LPWSTR>(lParam), 64, lpszInfo);
return FALSE;
}
int main()
{
WCHAR szDay[64];
BOOL bResult = ::EnumCalendarInfoExEx(
&EnumCalendarInfoProcExEx,
LOCALE_NAME_USER_DEFAULT,
ENUM_ALL_CALENDARS,
nullptr,
CAL_SDAYNAME1,
reinterpret_cast<LPARAM>(szDay)
);
if (!bResult)
{
wcout << L"Error" << endl;
return 0;
}
wcout << szDay << endl;
return 0;
}
A couple of things to watch out for:
I try use a GetLocaleInfoEx windows API and it worked well :)
int GetSystemStartDayOfWeek()
{
int ret;
DWORD StartDayOfWeek;
ret = GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT,
LOCALE_IFIRSTDAYOFWEEK | LOCALE_RETURN_NUMBER,
(LPTSTR)&StartDayOfWeek,
sizeof(StartDayOfWeek) / sizeof(TCHAR));
return StartDayOfWeek;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With