Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Im Win32 C programmer and I need to use WakeupOnStandBy code to write a program that wakes up my computer. How can I do it without MFC classes?

0
Posted

Im Win32 C programmer and I need to use WakeupOnStandBy code to write a program that wakes up my computer. How can I do it without MFC classes?

0

We used MFC to write WakeupOnStandBy to simplify the source code of all the GUI controls it has, but you can also do the same under Win32. Search the project for the use of the following API’s: CreateWaitableTimer, SetWaitableTimer, WaitForSingleObject, ShellExecute, SetSuspendState. These are the core functions that will also work under Win32 with minor changes. Here’s how the whole concept works: • Create waitable timer when your app starts up like this:hTimer = CreateWaitableTimer(NULL, TRUE, NULL); //[more info] • Then set waitable timer to the time to wake up your PC: (NOTE: The timer time units are measured in 100 nanosecond intervals, that is a second times 10 raised to the power of minus seven.)//’st’ is of SYSTEMTIME type, contains date & time to wake-up from Stand-by FILETIME ft; if(SystemTimeToFileTime(&st, &ft)) //[more info] { //Set large integer used by SetWaitableTimer //(Will use absolute time in 100 nanosecond intervals) LARGE_INTEGER li; //[more info] li.LowPart = ft.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123