Click here to Skip to main content
15,890,825 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralChange CProgressCtrl´s color Pin
VietDelphi6-May-03 6:27
VietDelphi6-May-03 6:27 
GeneralRe: Change CProgressCtrl´s color Pin
Michael Pauli6-May-03 6:35
Michael Pauli6-May-03 6:35 
GeneralRe: Change CProgressCtrl´s color Pin
VietDelphi6-May-03 6:43
VietDelphi6-May-03 6:43 
GeneralRe: Change CProgressCtrl´s color Pin
Michael Pauli7-May-03 0:44
Michael Pauli7-May-03 0:44 
GeneralThanks you ;o) Pin
VietDelphi8-May-03 3:23
VietDelphi8-May-03 3:23 
GeneralRe: Change CProgressCtrl´s color Pin
valikac6-May-03 8:55
valikac6-May-03 8:55 
GeneralRe: Change CProgressCtrl´s color Pin
VietDelphi6-May-03 10:00
VietDelphi6-May-03 10:00 
GeneralWeek numbers! Pin
Michael Pauli6-May-03 6:20
Michael Pauli6-May-03 6:20 
Hi!

All day I've been fighting with week numbers and their differed definitions (ISO standards). It's rather complicated just from searching the topic on the net! WOW.

I've made this and it SEEMS to work OK in the years arond 2003 - meaning giving the same # as outlook (although not 100% correct in all countries from what I can understand).

#define DAY_SUNDAY 1
#define DAY_MONDAY 2
#define DAY_TUESDAY 3
#define DAY_WEDNESDAY 4
#define DAY_THURSDAY 5
#define DAY_FRIDAY 6
#define DAY_SATURDAY 7

class CTimeEx : public CTime
{
public:
...

inline const int GetWeekNumber()
{
// I THINK this is right Smile | :)
CTimeEx tYearBefore(GetYear() - 1, GetMonth(), GetDay());
int iWeekNumber_OfFirstWeek = 0,
iWeekNumber_OfThisWeek = 0,
iWeeksInYearBefore = tYearBefore.GetWeeksInYear();
const CTimeEx tFirstDayInYear(GetYear(), 1, 1);
// First week containing at least four days is the first week of that year.
const int iDayOfWeekOfFirstDayInYear = tFirstDayInYear.GetDayOfWeek();
if(iDayOfWeekOfFirstDayInYear == DAY_FRIDAY ||
iDayOfWeekOfFirstDayInYear == DAY_SATURDAY ||
iDayOfWeekOfFirstDayInYear == DAY_SUNDAY)
iWeekNumber_OfFirstWeek = iWeeksInYearBefore;
else
iWeekNumber_OfFirstWeek = 1;
iWeekNumber_OfThisWeek = iWeekNumber_OfFirstWeek;
CTimeEx t(tFirstDayInYear);
const CTimeSpan tdOneDay(1, 0, 0, 0);
while(t.GetDayOfWeek() == CTimeEx::GetFirstDayOfWeek())
t += tdOneDay;
const CTimeSpan tDiff = *this - t;
if(tDiff.GetDays() > 0)
iWeekNumber_OfThisWeek = 1 + tDiff.GetDays() / 7;
return iWeekNumber_OfThisWeek;
}
inline const int GetWeeksInYear()
{
// We will always experience a week 53 when December 31st falls on a Thursday, or in the case of a leap year when December 31st falls on either a Thursday or a Friday.
int iWeeksInYear = 52;
CTimeEx tLastDayInYear(GetYear(), 12, 31);
if(IsLeapYear())
{
if(tLastDayInYear.GetDayOfWeek() == DAY_THURSDAY ||
tLastDayInYear.GetDayOfWeek() == DAY_FRIDAY)
iWeeksInYear = 53;
}
else
{
if(tLastDayInYear.GetDayOfWeek() == DAY_THURSDAY)
iWeeksInYear = 53;
}
return iWeeksInYear;
}
inline const bool IsLeapYear()
{ return((GetYear() % 100 == 0) && (GetYear() % 400 != 0)); }

...

};




Regards Michael Mogensen/dk/dev.
GeneralRe: Week numbers! Pin
Michael Pauli6-May-03 6:27
Michael Pauli6-May-03 6:27 
Questionhow to display a jpg file on screen Pin
katak6-May-03 6:13
katak6-May-03 6:13 
AnswerRe: how to display a jpg file on screen Pin
jmkhael6-May-03 6:45
jmkhael6-May-03 6:45 
AnswerRe: how to display a jpg file on screen Pin
Joe Woodbury6-May-03 7:38
professionalJoe Woodbury6-May-03 7:38 
AnswerRe: how to display a jpg file on screen Pin
RaajaOfSelf7-May-03 2:45
RaajaOfSelf7-May-03 2:45 
GeneralWindows API comunicate with console C program Pin
franklyflee6-May-03 6:01
franklyflee6-May-03 6:01 
GeneralRe: Windows API comunicate with console C program Pin
David Crow6-May-03 6:12
David Crow6-May-03 6:12 
GeneralRe: Windows API comunicate with console C program Pin
franklyflee6-May-03 6:52
franklyflee6-May-03 6:52 
GeneralRe: Windows API comunicate with console C program Pin
David Crow6-May-03 6:57
David Crow6-May-03 6:57 
GeneralRe: Windows API comunicate with console C program Pin
franklyflee6-May-03 7:18
franklyflee6-May-03 7:18 
GeneralRe: Windows API comunicate with console C program Pin
franklyflee6-May-03 15:12
franklyflee6-May-03 15:12 
GeneralRe: Windows API comunicate with console C program Pin
franklyflee6-May-03 16:14
franklyflee6-May-03 16:14 
Generalunicode Pin
alex.barylski6-May-03 5:42
alex.barylski6-May-03 5:42 
GeneralRe: unicode Pin
Phil Hamer6-May-03 13:34
Phil Hamer6-May-03 13:34 
GeneralRe: unicode Pin
alex.barylski6-May-03 14:47
alex.barylski6-May-03 14:47 
GeneralNeed to create Document and Excel in vc++ Pin
harinath6-May-03 5:24
professionalharinath6-May-03 5:24 
GeneralRe: Need to create Document and Excel in vc++ Pin
David Crow6-May-03 5:38
David Crow6-May-03 5:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.