@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: The GetDevicePowerState API !!!!C# Signature: [DllImport("kernel32.dll")] static extern bool GetDevicePowerState(IntPtr hDevice, out bool pfOn); !!!!User-Defined Types: None. !!!!Notes: None. !!!!Tips & Tricks: Please add some! !!!!Sample Code: // Get the power state of a harddisk (From http://msdn.microsoft.com/en-us/library/ms704147.aspx) string ReportDiskStatus() { string status = string.Empty; bool fOn = false; Assembly assembly = Assembly.GetExecutingAssembly(); FileStream[] files = assembly.GetFiles(); if (files.Length > 0) { IntPtr hFile = files[0].Handle; bool result = GetDevicePowerState(hFile, out fOn); if (result) { if (fOn) { status = "Disk is powered up and spinning"; } else { status = "Disk is sleeping"; } } else { status = "Cannot get Disk Status"; } Console.WriteLine(status); } return status; } !!!!Alternative Managed API: Do you know one? Please contribute it! Documentation: GetDevicePowerState@msdn on MSDN
Edit kernel32.GetDevic...
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.