|
Educated guesswork, don't quote me on this :
Real hard disk devices have firmware, and it's the firmware that reports this. (it will usually correspond to the 'friendly device name', I think). Disk drive producers will often include free utilities (such as some backup crapware), which will only run on their kit. The software has to check if their kit is connected, and it will do that by checking this field. Often, firmware must also be updated, usually using specific IOCTLs, and the firmware update utilities must be sure they don't clobber some other manufacturer's. This field may help in checking the origin of the kit before they issue their 'zap and destroy' IOCTLs. Some USB disk assemblies also offer firmware RAID configurations, and this may help their raid configuration utilities in determining the command set to configure them.
A storage card has no firmware, and so cannot report anything here (there may be exceptions, but I haven't come across any). If there's anything firmware worth reporting, it will be at the composite device level. Anyway, a storage card can only report anything when it's inserted, so this probably wouldn't serve your purpose.
|
|
|
|
|
Actually 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?
|
|
|
|
|
I'll dig around a bit, don't expect anything today, bedtime coming soon in my timezone
|
|
|
|
|
Based 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.
|
|
|
|
|
Sounds reasonable. This would probably correspond to a 'spin-down' on USB disks, which makes no sense on flash cards (they are only required to support D0 and D3, fully ON and fully OFF). Wonder what an SSD would have in this case?
|
|
|
|
|
Actually, 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.
|
|
|
|
|
I 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.
|
|
|
|
|
Except that only seems to work for one flash drive I have and not another. I'll continue to investigate that.
|
|
|
|
|
It 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..
|
|
|
|
|
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.
|
|
|
|
|
Hi all ,
I want to pass the table name as parameter to the method to obtain the result.
The code is as follows:-
<br />
private static String GetText(int id , String tableName)<br />
{ <br />
tbTest myTest = new tbTest();
<br />
myTest = dataContext.tbTests.Single(table => table.Test_id == id);<br />
<br />
return myTest.Test_Text;<br />
<br />
}<br />
Is there anyway where-in I can pass the id and table name to obtain the corresponding text (probably by strings ??) ?
I hope it makes sense.
thanks,
|
|
|
|
|
What? Is this a database question? We need more information.
|
|
|
|
|
I want to create and execute a dynamic query in the method by passing in the table name and ID.
I hope it makes sense.?
|
|
|
|
|
It makes sense, but it isn't enough information.
|
|
|
|
|
Please let me know wat info do u require?
<br />
private static String GetText(int id , String tableName)<br />
{ <br />
<br />
tbTest myTest = new tbTest();
<br />
myTest = dataContext.tbTests.Single(table => table.Test_id == id); <br />
<br />
return myTest.Test_Text;<br />
<br />
}<br />
I want the code to return the appropriate Text depending on the parameters passed ie tableName and ID
|
|
|
|
|
What you've presented is gibberish to me.
I want to know what you are trying to accomplish, not how you are trying to accomplish it (especially if it doesn't work).
0) Is there a database?
1) Is there a table in the database?
2) Are you trying to retrieve some information from that database table?
3) What is the schema of the table?
|
|
|
|
|
If you mean that the parameter tableName will be the name of class whose object you need to create, you can make use of reflection.
|
|
|
|
|
Reflection? I havnt used that before...can u elaborate on it plz. Thanks
|
|
|
|
|
|
Hi,
I am trying to set the IPConnectionMetric parameter of a network adapter in Windows 7. The method that I need to use is the "SetIPConnectionMetric" in the Win32_NetworkAdapterConfiguration class.
The problem is that the method returns an error code of 91 - Access Denied in Windows 7. However, this method works fine on Windows XP.
Can someone give me pointers to a solution? I played around with the Local Security Policies, but couldn't find anything
Here is more information about the method: http://msdn.microsoft.com/en-us/library/aa393303%28v=VS.85%29.aspx[^]
Thanks,
Karthik
|
|
|
|
|
Hi dear fellow developers,
I'm developing a new subsystem, where I need a list of search results. The list will contain more or less different object types, and as in ListBox I need the ability to click on the listed object, which can send the selected object to the propriated GUI; e.g.:
-------------------------------------
| <Adress object> |
| <Customer object> |
| <Customer object> |
| <Customer object> |
| <Adress object> |
| <Customer object> |
-------------------------------------
When clicking on Customer object, the customer gui will be shown with the selected object information inside. And when clicking on Adress object the adress gui will be shown with the selected object information inside, and so forth will all type of objects on the list.
I have looked at following lists:
Listbox:
This form of list couldn't make the tab index for making overview of different objects easier (As an last chance, I could use different colors, but the tabs wouldn't work still).
TreeView:
The view form are perfect and easy to make an overview with, but it seems like an disanvantage when getting to the click events, since it doesn't have the "SelectItem" object function.
ListView:
Havn't seen much on this one yet. Sounded like an solution to my needs, but doubt since it seems to have the split screen information, which showing information or contains of the left screen selection.
Any with some experience who could calculate which type of list for my needs here? Please help.
Best regards
|
|
|
|
|
I do not fully understand your objection to the TreeView Control.
Consider any of the many C# Explorer clones you can find on the web. They all have a TreeView in one pane and when you click on any of the nodes the appropriate information is displayed in another pane. It doesn't matter whether a Folder node or a File node is clicked.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
the whole idea with using TreeView, is to have Aparment object as parent, and customer names as children. When the user db. click apartment object, the apartment GUI will open with the selected object information in the apartment information fields. And if the user db. click customer, the customer GUI will open with the selected customer information filled into the fields.
Did it make it any clear, or still confusion about my use of the treeview?
|
|
|
|
|
grmihel2 wrote: TreeView ... doesn't have the "SelectItem"
You can store the item in the Tag property, that's what I do.
|
|
|
|
|
I'll try to use the tag function then, and see how it works. I'm used to ListBox's and items in it, so I think it just need another pov to understand the TreeView with tags. But thnx for your suggestion.
|
|
|
|