Click here to Skip to main content
15,910,787 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: mutex problem Pin
Mark Salsbery4-Aug-07 8:32
Mark Salsbery4-Aug-07 8:32 
GeneralRe: mutex problem Pin
JudyL_MD6-Aug-07 2:31
JudyL_MD6-Aug-07 2:31 
QuestionSubclassing and hooking the Microsoft Office 2000/2003/2007 File Open / Save Dialog boxes using Win32 C code Pin
JuggernautMsn4-Aug-07 2:23
JuggernautMsn4-Aug-07 2:23 
AnswerRe: Subclassing and hooking the Microsoft Office 2000/2003/2007 File Open / Save Dialog boxes using Win32 C code Pin
Mark Salsbery4-Aug-07 6:48
Mark Salsbery4-Aug-07 6:48 
AnswerRe: Subclassing and hooking the Microsoft Office 2000/2003/2007 File Open / Save Dialog boxes using Win32 C code Pin
Force Code4-Aug-07 9:28
Force Code4-Aug-07 9:28 
GeneralRe: Subclassing and hooking the Microsoft Office 2000/2003/2007 File Open / Save Dialog boxes using Win32 C code Pin
Force Code4-Aug-07 13:41
Force Code4-Aug-07 13:41 
GeneralRe: Subclassing and hooking the Microsoft Office 2000/2003/2007 File Open / Save Dialog boxes using Win32 C code Pin
JuggernautMsn6-Aug-07 10:07
JuggernautMsn6-Aug-07 10:07 
QuestionPC wakeup from hibernation using SetWaitableTimer() Pin
Still learning how to code4-Aug-07 1:36
Still learning how to code4-Aug-07 1:36 
Having read a number of articles on waking a PC up from hibernation, I have tried to do this using the following code:-

hTimer = (HANDLE)CreateWaitableTimer(NULL, TRUE, "My Waitable test Wake Up Timer");

unsigned threadId;
HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, &wakeupWatchThread, &hTimer, NULL, &threadId);

return TRUE; // return TRUE unless you set the focus to a control

The worker thread code is:-

unsigned __stdcall wakeupWatchThread(void* dummy)
{
LARGE_INTEGER lElapse;
int i1 = 63000;
int i2 = 100000;
lElapse.QuadPart = - (i1*i2); // About 10.5 mins elapsed

BOOL result = SetWaitableTimer(hTimer, &lElapse, 0, TimerProc, NULL, TRUE);

DWORD dwError;
if(result == FALSE)
dwError = GetLastError();

for (int i = 0; i < 10; i++)
SleepEx(INFINITE, TRUE);

return 0;
}


and the timer completion code is :-
void CALLBACK TimerProc(LPVOID lpArgToCompletionRoutine,
DWORD dwTimerLowValue,
DWORD dwTimerHighValue)
{
CTime tNow(CTime::GetCurrentTime());
CString szTime, szMsg;
szTime = tNow.Format( "%A %H:%M" );
szMsg.Format("Waitable timer expired at %s",szTime);
AfxMessageBox(szMsg);
}

My problem is that the PC doesn't wake up !! (the last parameter of SetWaitableTimer() being set to TRUE should cause the reume from hibernation).
When I manual start the PC, the timer has expired. Is there something that I'm not doing ? (Tested on Win2000 Pro only, as this will be the only target system)

Doug
AnswerRe: PC wakeup from hibernation using SetWaitableTimer() Pin
Still learning how to code5-Aug-07 2:17
Still learning how to code5-Aug-07 2:17 
QuestionProblem with OnDrawClipboard Pin
dSolariuM4-Aug-07 1:12
dSolariuM4-Aug-07 1:12 
QuestionTapi reconnection Pin
mehrdadov4-Aug-07 0:06
mehrdadov4-Aug-07 0:06 
QuestionVS 2003 Tab Controls Pin
Code_Ray3-Aug-07 13:08
Code_Ray3-Aug-07 13:08 
AnswerRe: VS 2003 Tab Controls Pin
Mark Salsbery3-Aug-07 13:37
Mark Salsbery3-Aug-07 13:37 
AnswerRe: VS 2003 Tab Controls Pin
Michael Dunn3-Aug-07 14:48
sitebuilderMichael Dunn3-Aug-07 14:48 
AnswerRe: VS 2003 Tab Controls Pin
bob169723-Aug-07 16:15
bob169723-Aug-07 16:15 
QuestionPrinting in MFC [modified] Pin
hxhl953-Aug-07 12:30
hxhl953-Aug-07 12:30 
AnswerRe: Printing in MFC Pin
bob169723-Aug-07 16:02
bob169723-Aug-07 16:02 
QuestionRe: Printing in MFC Pin
hxhl953-Aug-07 19:32
hxhl953-Aug-07 19:32 
AnswerRe: Printing in MFC Pin
bob169724-Aug-07 3:41
bob169724-Aug-07 3:41 
GeneralRe: Printing in MFC Pin
hxhl954-Aug-07 6:36
hxhl954-Aug-07 6:36 
AnswerRe: Printing in MFC Pin
bob169723-Aug-07 16:25
bob169723-Aug-07 16:25 
AnswerRe: Printing in MFC Pin
hxhl954-Aug-07 6:42
hxhl954-Aug-07 6:42 
GeneralRe: Printing in MFC Pin
bob169724-Aug-07 8:38
bob169724-Aug-07 8:38 
GeneralRe: Printing in MFC Pin
Bram van Kampen5-Aug-07 3:11
Bram van Kampen5-Aug-07 3:11 
AnswerRe: Printing in MFC Pin
hxhl955-Aug-07 9:56
hxhl955-Aug-07 9:56 

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.