|
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.
|
|
|
|
|
TreeView's way is better.
|
|
|
|
|
Ye I guess it might be, when you first explore the way they work, and figure tag functions
|
|
|
|
|
So, I gave this a try today for my ImageViewer UserControl (See my articles for more detail on it). And people have requested me to implement Multi-Page TIFF support.
Now I have been trying lots of different techniques for it but none of them seem to really work. My UserControl accepts images in 2 different ways. By passing in a FilePath or an Image through properties. Both these properties end up with having storing the image into a Bitmap.
Now this Bitmap is used in my Draw methods and if I try to do a SelectActiveFrame() it crashes on me with GDI+ An generic error has occured ExternalException (0x80004005).
What I tried to do is creating a new Bitmap of the original and then doing the SelectActiveFrame() and that did not crash. However it did not display either.
Here is a sample of my code from my DrawObject class:
pages = this.bmp.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page);
currentPage = 0;
if (pages > 1) { multiPage = true; } else { multiPage = false; }
public void NextPage()
{
try
{
if (this.bmp != null)
{
int nextPage = this.currentPage + 1;
if (nextPage <= this.pages)
{
Bitmap myImg = new Bitmap(this.bmp);
myImg.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page, nextPage);
this.bmp.Dispose();
this.bmp = null;
this.bmp = myImg;
currentPage = nextPage;
}
}
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show("ImageViewer error: " + ex.ToString());
}
}
And here is the code that calls the NextPage() function:
drawing.NextPage();
pbFull.Refresh();
UpdatePanels(true);
And PreviousPage() is exactly the same but with a minus ofcourse.
Any help would be much appreciated, I've been staring at it for hours now
|
|
|
|
|
Hi,
I don't expect "new Bitmap(image)" to return a multi-page image, so what you should try is select the page you want in the original image, then create a new bitmap from it.
there are some CodeProjects about multi-page TIFF images, here[^] is one.
|
|
|
|
|
Well that is exactly what I tried to do Originally, and I already looked at the exact multi-page tiff viewer. The problem is, within the viewer when switching to the next page it loads the entire TIFF file again and then makes a Bitmap of it.
The problem with this is, my UserControl doesn't neccesarily has to have a file path (Because it can be passed in programmetically aswell). And to store the original TIFF file next to the Bitmap it would mean that I need double the resource for the same image. And once the TIFF file is loaded, there is no way to tell when opening a new image (going to next page for example) if it's
A.) The same TIFF file.
B.) Actually a Multi-Page TIFF file.
What this means is that I have no idea when to Dispose() the original TIFF file which would result in using unneccesary resources. With Multi-page TIFF files this could be ALOT!
I also tried Cloning the object but when I do that it gets locked and I get the same GDI+ generic error. Believe me I tried so many things.
I was just hoping someone would be like.. You forgot this little line.
Thanks for your help tho
modified on Thursday, April 29, 2010 8:03 AM
|
|
|
|
|
Jordy "Kaiwa" Ruiter wrote: to store the original TIFF file next to the Bitmap it would mean that I need double the resource for the same image
I don't think so. You load the (multi-page) image once, and keep one (or more) references to it; and you need a bitmap that represents one page, that will cost you a fraction of the multi-page image.
You could encapsulate things in a little class (more error handling may be needed):
class MultiPageImage {
private Image image;
public Image Image {
get {
return image;
}
set {
if (image!=null) image.Dispose;
image=value;
}
}
public Bitmap GetBitmap() {
if (image==null) return null;
return new Bitmap(image);
}
public Bitmap GetBitmap(int pageNumber) {
if (image==null) return null;
image.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page, nextPage);
return new Bitmap(image);
}
}
Warning: if you don't actually copy the multi-page image, the current page setting is affecting both this class and the external image users. For perfect encapsulation, one would have to copy the image in the setter property.
|
|
|
|