@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: Enumerates devices on the system that meet the specified criteria. !!!!C# Signature: [DllImport("powrprof.dll", SetLastError=true, CharSet = CharSet.Auto)] [return: MarshalAs(UnmanagedType.Bool)] static extern bool DevicePowerEnumDevices(uint queryIndex, QueryInterpretationFlags queryInterpretationFlags, QueryFlags queryFlags, IntPtr pReturnBuffer, ref uint pBufferSize); !!!!VB Signature: Declare Function DevicePowerEnumDevices Lib "powrprof.dll" (TODO) As TODO !!!!User-Defined Types: QueryInterpretationFlags, QueryFlags !!!!Alternative Managed API: Do you know one? Please contribute it! !!!!Notes: If pReturnBuffer is NULL, pBufferSize will be filled with the size needed to return the data. !!!!Tips & Tricks: Please add some! !!!!Sample Code: const int MAX_PATH = 261; if (!DevicePowerOpen(0)) return; // error uint size = MAX_PATH; IntPtr ptrBuffer = Marshal.AllocHGlobal((int)size); uint index = 0; bool result = false; try { while ((ptrBuffer != IntPtr.Zero) && (result = DevicePowerEnumDevices(index, QueryInterpretationFlags.DEVICEPOWER_FILTER_DEVICES_PRESENT, QueryFlags.PDCAP_D2_SUPPORTED, ptrBuffer, ref size)) != false) { string strBuffer = Marshal.PtrToStringUni(ptrBuffer); string str = string.Format("Device name: {0}\n", strBuffer); index++; } } finally { Marshal.FreeHGlobal(ptrBuffer); DevicePowerClose(); } Documentation: DevicePowerEnumDevices@msdn on MSDN
Edit powrprof.devicepo...
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.