Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8223635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:46:35+00:00 2026-06-07T14:46:35+00:00

The last day i’ve tried to make this work: Wake up my computer from

  • 0

The last day i’ve tried to make this work: Wake up my computer from sleep or hibernation, using a WPF application. Nothing i’ve tried worked.

So far I’ve tried the most popular examples on the net.. For example:

[DllImport("kernel32.dll")]
        public static extern SafeWaitHandle CreateWaitableTimer(IntPtr lpTimerAttributes, 
                                                                  bool bManualReset,
                                                                string lpTimerName);

        [DllImport("kernel32.dll", SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool SetWaitableTimer(SafeWaitHandle hTimer, 
                                                    [In] ref long pDueTime, 
                                                              int lPeriod,
                                                           IntPtr pfnCompletionRoutine, 
                                                           IntPtr lpArgToCompletionRoutine, 
                                                             bool fResume);


        public static void SetWaitForWakeUpTime()
        {
            DateTime utc = DateTime.Now.AddMinutes(2);
            long duetime = utc.ToFileTime();

            using (SafeWaitHandle handle = CreateWaitableTimer(IntPtr.Zero, true, "MyWaitabletimer"))
            {
                if (SetWaitableTimer(handle, ref duetime, 0, IntPtr.Zero, IntPtr.Zero, true))
                {
                    using (EventWaitHandle wh = new EventWaitHandle(false, EventResetMode.AutoReset))
                    {
                        wh.SafeWaitHandle = handle;
                        wh.WaitOne();
                    }
                }
                else
                {
                    throw new Win32Exception(Marshal.GetLastWin32Error());
                }
            }

            // You could make it a recursive call here, setting it to 1 hours time or similar
            Console.WriteLine("Wake up call");
            Console.ReadLine();
        }

And the usage:

WakeUp.SetWaitForWakeUpTime();

I’ve also tried this example (see how I use the method after the code):

public event EventHandler Woken;

private BackgroundWorker bgWorker = new BackgroundWorker();

public WakeUp()
{
    bgWorker.DoWork += new DoWorkEventHandler(bgWorker_DoWork);
    bgWorker.RunWorkerCompleted += 
      new RunWorkerCompletedEventHandler(bgWorker_RunWorkerCompleted);
}

public void SetWakeUpTime(DateTime time)
{
    bgWorker.RunWorkerAsync(time.ToFileTime());
}

void bgWorker_RunWorkerCompleted(object sender, 
              RunWorkerCompletedEventArgs e)
{
    if (Woken != null)
    {
        Woken(this, new EventArgs());
    }
}

private void bgWorker_DoWork(object sender, DoWorkEventArgs e) 
{
    long waketime = (long)e.Argument;

    using (SafeWaitHandle handle = 
              CreateWaitableTimer(IntPtr.Zero, true, 
              this.GetType().Assembly.GetName().Name.ToString() + "Timer"))
    {
        if (SetWaitableTimer(handle, ref waketime, 0, 
                               IntPtr.Zero, IntPtr.Zero, true))
        {
            using (EventWaitHandle wh = new EventWaitHandle(false, 
                                                   EventResetMode.AutoReset))
            {
                wh.SafeWaitHandle = handle;
                wh.WaitOne();
            }
        }
        else
        {
            throw new Win32Exception(Marshal.GetLastWin32Error());
        }
    }
}

}

And the usage:

WakeUp w = new WakeUp();
                w.Woken += new EventHandler(w_Woken);
                w.SetWakeUpTime(alarmDate.Subtract(new TimeSpan(0,0,0,20)));

Nothing seems to wake up my PC.

I know it is possible, as several other alarm clocks can do it. They manage to wake up my computer with no problems, so there must be some mistake.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T14:46:37+00:00Added an answer on June 7, 2026 at 2:46 pm

    The problem was not all computers support this issue. There is apparently not much to do if your computer doesn’t support it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I also got this same problem from last day. i tried 2-3 time to
Hey, have been trying to work this out for last day or so but
I have tried the last day to work with the Ruby gem git (version
I have some date and I want to get last x day before this
I need all the records from last day? Hi Select * from table1 where
I've been scratching my head with this for the last day.. hope someone can
How to validate user input date is the last day of the month using
I have been trying to learn pygame the last day or so, and tried
I am successfully using following strtotime command with PHP 5.3 echo strtotime('last day of
I am using for my gis project openlayers and extjs .. last day i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.