HostPowerWin.cpp revision a62ce5472a6bd50322d061cb720cd84ae5038371
9d473abea9a9b6597b2b20bedc950ba33a2e73a5vboxsync * VirtualBox interface to host's power notification service
98b57301cf15ff5f95eaf7bc8b81e57750026b8evboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync * available from http://www.virtualbox.org. This file is free software;
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync * you can redistribute it and/or modify it under the terms of the GNU
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync * General Public License (GPL) as published by the Free Software
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
98b57301cf15ff5f95eaf7bc8b81e57750026b8evboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync * additional information or have any questions.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync/*******************************************************************************
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync* Header Files *
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync*******************************************************************************/
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncstatic WCHAR gachWindowClassName[] = L"VBoxPowerNotifyClass";
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncHostPowerServiceWin::HostPowerServiceWin(VirtualBox *aVirtualBox) : HostPowerService(aVirtualBox)
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync int rc = RTThreadCreate (&mThread, HostPowerServiceWin::NotificationThread, this, 65536,
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "MainPower");
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync Log(("HostPowerServiceWin::HostPowerServiceWin: RTThreadCreate failed with %Rrc\n", rc));
bcc2356dccf06ea3fdd1f3e4d4e62b04e95673d0vboxsync Log(("HostPowerServiceWin::!HostPowerServiceWin: destroy window %x\n", mHwnd));
5b802b5e11fed6e163afca32e9118d2599d312fbvboxsync /* Is this allowed from another thread? */
5b802b5e11fed6e163afca32e9118d2599d312fbvboxsync /* Send the quit message and wait for it be processed. */
if (atomWindowClass == 0)
if (hwnd)
if (atomWindowClass != 0)
atomWindowClass = 0;
switch (msg)
case WM_POWERBROADCAST:
if (pPowerObj)
switch(wParam)
case PBT_APMSUSPEND:
case PBT_APMRESUMEAUTOMATIC:
case PBT_APMPOWERSTATUSCHANGE: