Click here to Skip to main content
15,868,047 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Iterate Registry key for value Pin
KarstenK22-Jun-09 21:28
mveKarstenK22-Jun-09 21:28 
QuestionOutput like a webcam Pin
squirly422-Jun-09 20:47
squirly422-Jun-09 20:47 
AnswerRe: Output like a webcam Pin
Code-o-mat22-Jun-09 22:40
Code-o-mat22-Jun-09 22:40 
Questioninverse function of SystemTimeToTzSpecificLocalTime() - OS = Win2K Pin
includeh1022-Jun-09 20:43
includeh1022-Jun-09 20:43 
AnswerRe: inverse function of SystemTimeToTzSpecificLocalTime() Pin
Stuart Dootson22-Jun-09 21:36
professionalStuart Dootson22-Jun-09 21:36 
GeneralRe: inverse function of SystemTimeToTzSpecificLocalTime() Pin
includeh1022-Jun-09 21:52
includeh1022-Jun-09 21:52 
GeneralRe: inverse function of SystemTimeToTzSpecificLocalTime() Pin
Stuart Dootson22-Jun-09 22:25
professionalStuart Dootson22-Jun-09 22:25 
GeneralRe: inverse function of SystemTimeToTzSpecificLocalTime() Pin
includeh1022-Jun-09 22:51
includeh1022-Jun-09 22:51 
TzSpecificLocalTimeToSystemTime function requires XP, not for Win2k.

I have created 2 functions and solved the problem, the 2 are:


void GreenwichTimeToLocalTime(const SYSTEMTIME&tmSys,SYSTEMTIME&tmLocal)
{
SYSTEMTIME tmS,tmL;
::GetSystemTime(&tmS);
::GetLocalTime(&tmL);

FILETIME ftS,ftL;
::SystemTimeToFileTime(&tmS,&ftS);
::SystemTimeToFileTime(&tmL,&ftL);

ULARGE_INTEGER ulS,ulL;

ulS.HighPart=ftS.dwHighDateTime;
ulS.LowPart =ftS.dwLowDateTime;

ulL.HighPart=ftL.dwHighDateTime;
ulL.LowPart =ftL.dwLowDateTime;

__int64 i64=ulL.QuadPart-ulS.QuadPart;

FILETIME ftSys;
::SystemTimeToFileTime(&tmSys,&ftSys);

ULARGE_INTEGER ulSys;
ulSys.HighPart =ftSys.dwHighDateTime;
ulSys.LowPart =ftSys.dwLowDateTime;

ulSys.QuadPart+=i64;

FILETIME ftLocal;
ftLocal.dwHighDateTime =ulSys.HighPart;
ftLocal.dwLowDateTime =ulSys.LowPart;

::FileTimeToSystemTime(&ftLocal,&tmLocal);
}

void LocalTimeToGreenwichTime(const SYSTEMTIME&tmLocal,SYSTEMTIME&tmUTC)
{
SYSTEMTIME tmS,tmL;
::GetSystemTime(&tmS);
::GetLocalTime(&tmL);

FILETIME ftS,ftL;
::SystemTimeToFileTime(&tmS,&ftS);
::SystemTimeToFileTime(&tmL,&ftL);

ULARGE_INTEGER ulS,ulL;

ulS.HighPart=ftS.dwHighDateTime;
ulS.LowPart =ftS.dwLowDateTime;

ulL.HighPart=ftL.dwHighDateTime;
ulL.LowPart =ftL.dwLowDateTime;

__int64 i64=ulL.QuadPart-ulS.QuadPart;

FILETIME ftLocal;
::SystemTimeToFileTime(&tmLocal,&ftLocal);

ULARGE_INTEGER ulLocal;
ulLocal.HighPart=ftLocal.dwHighDateTime;
ulLocal.LowPart =ftLocal.dwLowDateTime;

ulLocal.QuadPart-=i64;

FILETIME ftUTC;
ftUTC.dwHighDateTime=ulLocal.HighPart;
ftUTC.dwLowDateTime =ulLocal.LowPart;

::FileTimeToSystemTime(&ftUTC,&tmUTC);
}
GeneralRe: inverse function of SystemTimeToTzSpecificLocalTime() Pin
Stuart Dootson22-Jun-09 22:57
professionalStuart Dootson22-Jun-09 22:57 
AnswerRe: inverse function of SystemTimeToTzSpecificLocalTime() - OS = Win2K Pin
cmk23-Jun-09 10:42
cmk23-Jun-09 10:42 
QuestionUsing VS 2008 Pin
Deepu Antony22-Jun-09 20:28
Deepu Antony22-Jun-09 20:28 
AnswerRe: Using VS 2008 Pin
KarstenK22-Jun-09 21:31
mveKarstenK22-Jun-09 21:31 
GeneralRe: Using VS 2008 Pin
Deepu Antony22-Jun-09 21:32
Deepu Antony22-Jun-09 21:32 
AnswerRe: Using VS 2008 Pin
Stuart Dootson22-Jun-09 21:31
professionalStuart Dootson22-Jun-09 21:31 
GeneralRe: Using VS 2008 Pin
Deepu Antony22-Jun-09 21:38
Deepu Antony22-Jun-09 21:38 
GeneralRe: Using VS 2008 Pin
Stuart Dootson22-Jun-09 23:08
professionalStuart Dootson22-Jun-09 23:08 
GeneralRe: Using VS 2008 Pin
Deepu Antony22-Jun-09 23:57
Deepu Antony22-Jun-09 23:57 
QuestionMFC Pin
p_196022-Jun-09 19:47
p_196022-Jun-09 19:47 
AnswerRe: MFC Pin
Chandrasekharan P22-Jun-09 19:51
Chandrasekharan P22-Jun-09 19:51 
GeneralRe: MFC Pin
p_196022-Jun-09 20:02
p_196022-Jun-09 20:02 
GeneralRe: MFC Pin
Chandrasekharan P22-Jun-09 20:22
Chandrasekharan P22-Jun-09 20:22 
GeneralRe: MFC Pin
p_196022-Jun-09 20:33
p_196022-Jun-09 20:33 
AnswerRe: MFC Pin
Rajesh R Subramanian22-Jun-09 21:14
professionalRajesh R Subramanian22-Jun-09 21:14 
AnswerRe: MFC Pin
Hamid_RT22-Jun-09 22:19
Hamid_RT22-Jun-09 22:19 
QuestionPreventing Sleep (sometimes) Pin
Peter Weyzen22-Jun-09 14:44
Peter Weyzen22-Jun-09 14:44 

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.