# Receive callback if computer wakes from sleep on Windows

**URL:** <https://discourse.julialang.org/t/receive-callback-if-computer-wakes-from-sleep-on-windows/81015>\
**Category:** General Usage\
**Tags:** windows, operating-system\
**Created:** [May 13, 2022, 12:59pm UTC](https://discourse.julialang.org/t/receive-callback-if-computer-wakes-from-sleep-on-windows/81015 "2022-05-13T12:59:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![taotree](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/taotree/32/31982_2.png) [@taotree](https://discourse.julialang.org/u/taotree)\
**Post date:** [May 13, 2022, 12:59pm UTC](https://discourse.julialang.org/t/receive-callback-if-computer-wakes-from-sleep-on-windows/81015/1 "2022-05-13T12:59:21Z")

</div>

I’d like to get a callback when the computer wakes from sleep on Microsoft Windows. I see there are [Windows APIs](https://docs.microsoft.com/en-us/windows/win32/power/registering-for-power-events) for this: and I’m a little familiar with [calling c code](https://docs.julialang.org/en/v1/manual/calling-c-and-fortran-code/) but it’s talking about windows applications, services, etc. that I’m having a hard time translating. I think I would call [RegisterPowerSettingNotification](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-registerpowersettingnotification) but my julia code doesn’t really own a window handle, nor is it a service, so… I’m not sure where to go from there.

I know I could create a workaround such as: create a timer that would wake up regularly and check if it the computer had been asleep by checking the last run time, but I’d prefer to get a notification from the OS if possible.
