Just so people reading this know... it turns out the original solution I found is working again. I don't know if it was a glitch in how my system was reporting the information or whether the second, more thorough method is just more fool-proof. I'm getting the power data through setupapi.dll rather than through powerprof.dll though, since I'm trying to move away from WMI.
brian shapiro
Posts
-
WMI and the difference between memory cards and USB drives -
WMI and the difference between memory cards and USB drivesIt was my error; the problem was it didn't find a drive with that drive letter because it was referring to the Portable Device, and thats listed by the Volume name if there is one. But I finally found something that works! If you enumerate the hardware ID strings for the devices that support D2, the only ones that show up are the ones for flash drives. The memory cards are enumerated I think, but a query for the hardware ID returns an empty string. So you have to find the PnPEntity associated with the DiskDrive, and take the first indexed HardwareID. No problems with this so far..
-
WMI and the difference between memory cards and USB drivesExcept that only seems to work for one flash drive I have and not another. I'll continue to investigate that.
-
WMI and the difference between memory cards and USB drivesI figured out what I did wrong --- you have to do a check on the Logical Disk name, not the Disk Drive name. The Disk Drive for the card reader supports more power states, and the Portable Device (listed in Device Manager) supports even more, including D1.
-
WMI and the difference between memory cards and USB drivesActually, this doesn't seem to be working.. I thought it was, but I must have been mistaken. The internal card readers don't support D2, but the external card readers do.
-
WMI and the difference between memory cards and USB drivesBased on the devices that I have, I figured out that you can expect a USB Flash Drive to have PDCAP_D2_SUPPORTED under "Power data" in Device Manager, but not a memory card. So I used a PInvoke to DevicePowerEnumDevices in PowrProf.dll ( http://msdn.microsoft.com/en-us/library/aa372681(VS.85).aspx[^] ). That allowed me to filter by the device name in Win32_DiskDrive.Model and the PDCAP_D2_SUPPORTED flag.
-
WMI and the difference between memory cards and USB drivesActually it kind of would serve my purpose -- I just want to determine whether a logical disk is hosted by a card reader, or is hosted by a USB drive. If I could determine the 'bus reported' description for any given USB Mass Storage Device.. but I don't know how to do that. Can you help?
-
WMI and the difference between memory cards and USB drivesI've noticed in Device Manager that the Mass Storage Devices for the multi-card readers I own have a "Bus reported device description" of "Mass Storage Device" -- a generic name -- but the one for the USB drive instead has the description of the device name. Is this at all significant? And where does the "Bus reported device description" come from?
-
WMI and the difference between memory cards and USB drivesHow would I determine that? Just look up if there's more than one dependent drive on to the USB Mass Storage device? But I want to account for cases in which the card reader is only able to read one type of card, and I'm not sure how this is distinguishable in WMI.
-
WMI and the difference between memory cards and USB drivesI want to use WMI to tell the difference between a removable media thats a memory card and a USB drive. It would seem there is some way, because on the menu for Safely Remove Hardware you can choose to eject the disks in a card reader individually while not ejecting the hardware (a mass storage device), while for a USB drive you're choosing to eject the drive. Brian
-
Windows 7, SetWindowPos, and AnimateWindowI have a project where I'm using SetWindowPos through pinvoke to show a frameless window. In Windows Vista, when the window would load, there would be no window opening animation, but now that I'm running the project in Windows 7 the animation is there. I'm now trying to use AnimateWindow to change the opening animation so that the length is 0. But I'm having trouble accomplishing anything with AnimateWindow except changing the behavior to hiding the window instead of showing it. Is there anyone who can help? Do we have any forum here specifically for Win32 API discussions?
-
Can I retrieve Clocks associated with HasAnimatedPropertiesIs there any way to programatically retrieve whatever clock is controlling a UIElement with HasAnimatedProperties, so you can hook an event handler to timeline events that were created by a style template?--without parsing the raw XAML. I need my control to wait until any animations are completed to effect a change in state.
-
How to use RoutedCommands like TogglePlayPauseI'm wondering what the practice is for using a command that toggles states between two other commands. If I implemented something like the existing command TogglePlayPause, how would it notify the button what state it should be in, pause or play--without creating a custom button control? What I'm trying to do is implement a ToggleMaximizeRestore for a frameless window, and I'm not sure how to implement it so that all of the command logic is taken care of.