|
Does anyone know how I can get the current screen Color Quality. I can get the resolution but am stuck finding the quality.
Thanks
Michael
|
|
|
|
|
 Hi,
the only way I am aware of is through P/Invoke, using
[DllImport("user32.dll")]
public static extern int EnumDisplaySettings (string deviceName,
int modeNum, ref DEVMODE1 devMode );
[StructLayout(LayoutKind.Sequential)]
public struct DEVMODE1 {
[MarshalAs(UnmanagedType.ByValTStr,SizeConst=32)] public string dmDeviceName;
public short dmSpecVersion;
public short dmDriverVersion;
public short dmSize;
public short dmDriverExtra;
public int dmFields;
public short dmOrientation;
public short dmPaperSize;
public short dmPaperLength;
public short dmPaperWidth;
public short dmScale;
public short dmCopies;
public short dmDefaultSource;
public short dmPrintQuality;
public short dmColor;
public short dmDuplex;
public short dmYResolution;
public short dmTTOption;
public short dmCollate;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string dmFormName;
public short dmLogPixels;
public short dmBitsPerPel;
public int dmPelsWidth;
public int dmPelsHeight;
public int dmDisplayFlags;
public int dmDisplayFrequency;
public int dmICMMethod;
public int dmICMIntent;
public int dmMediaType;
public int dmDitherType;
public int dmReserved1;
public int dmReserved2;
public int dmPanningWidth;
public int dmPanningHeight;
};
with mode set to ENUM_CURRENT_SETTINGS (=-1)
|
|
|
|
|
SO I have to pass the Display card name to this function and then get the info from dmcolor?
If I don't know the Display card name and this is dunning on over 250 machine with different cards how do I get this info?
Thanks
|
|
|
|
|
I did provide you with some pointers and useful code.
For the details they invented a thing called documentation[^] which google will be happy to locate for you.
|
|
|
|
|
Thanks for your help. I've been googling all afternoon trying to find this info and understand it.
Hope you have a good evening.
|
|
|
|
|
Hi guys, I am having difficutly downloading msdn/msnd2 for Visual Studio 2005. Can anyone of you please provide me a link so i can download Visual 2005 2.0 msdn.
Thanks
|
|
|
|
|
|
Hi I am creating an application through which the user can select a mode and that will change the icon. I have added different icons to my project but don't know how to change the icon.
Note: What I'm trying to do is not the same as going into properties in visual studios and changing the icon.
Any help would be great.
Thanks,
Prateek
|
|
|
|
|
Hi,
a file has an icon in Windows Explorer; for an EXE file that icon is set at build time through the project properties.
a Form most often has a visible icon in the title bar; that one is set through the Icon property of the Form, either through Visual Designer or by run-time code. It is also used in the task bar and in the task switcher (ALT-TAB). You would typically add one or more ICO files to the project, set them to be handled as an "embedded resource", then load them from there e.g. with the Icon constructor that takes a Type and a resource name. You can also see how Visual Designer does it, and copy and adapt that code.
|
|
|
|
|
you mean
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
but, what is "$this.Icon" referring to? and from where can I change the location of the icon?
Prateek
|
|
|
|
|
No, first use Visual Designer to assign some icon to the Form other than the application icon (that is the default and generates the line you quoted). Then look at the VD code and work from there.
|
|
|
|
|
That's exactly what I did and found this code in the designer.
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
I also tried looking for the filename, but couldn't find it. Where should I be looking? and/or what should I do now?
|
|
|
|
|
Sorry, I got confused about resources once more.
1.
The icon you assign to Form myForm using VD gets stored in file myForm.resx, and the $this then refers to myForm.
2.
This is the code you need to activate an embedded icon resource (Build Action=embedded resource) in general:
this.Icon=new Icon(this.GetType(), "name.ico");
assuming the file is at the top-level of your solution.
If you put it in say directory resources , then the name changes to "resources.name.ico"
|
|
|
|
|
Thanks a lot. That was very helpful information.
Prateek
|
|
|
|
|
hai gud evening,
if i can get data from database for that i can use combo box,i can select one item in combo box but the corresponding item didnot display,another item should be display to the first time selection of the combo box but i can select another time the correct item should be display,whats wrong in my coding
plz give me a solution to my problem.
thanking u.
|
|
|
|
|
Ok, post your code so we can take a look at it, we can't guess what you wrote and ask us what's wrong with it.
Also try to clean up your question I'm having an extremely hard time understanding what it is you want.
|
|
|
|
|
Hi,
What do you mean exactly? send some code, maybe then we can help.
|
|
|
|
|
Hi,
Recently I'm working on small compiler for fun (or actually still thinking about it's main features and implementing basic syntax) and I've ran into strange problem. Something that I thought would be easy seem not to be that easy . What is troubling my mind, is that construction:
int[] b = new int [100];
fixed (int* p = b)
{
int* z = p;
for (int i = 0; i < 100; ++i)
{
*z = i;
z++;
}
}
Such code when compiled and disassembled produces such code:
.locals init ([0] int32[] b,
[1] int32 i,
[2] int32& pinned p,
[3] int32* z,
[4] bool CS$4$0000,
[5] int32[] CS$0$0001)
[...].IL_0031: ldloc.s CS$0$0001
IL_0033: ldc.i4.0
IL_0034: ldelema [mscorlib]System.Int32
IL_0039: stloc.2
This code, from what I understand after searching information in MSDN and few other articles, pins table b (table [5] is the same as b) by pointing to it's first element with p pointer.
I've tried to produce such code using ILGenerator, but I have no idea how to declare local variable of type int& (managed pointer), I guess I can declare only int* pointers, now the main question is, will above code work if I change [2] int32& pinned p to [2] int* pinned p . If yes, why compiler uses this type, not just int* pointers, if no - how I can generate such code using code emit?
I've made small test, disassembled code compiled with csc, changed pointer from int& to int* and yes, it works, but I can't prove anything with that, because GC had no reason to move the table in memory and I can't force him to try that, so that answered nothing except that I know such construction would be legal.
[Solution]
For future use hehe, I'll post solution I've come by accident, and it does seem to work:
ilGen.DeclareLocal(Type.GetType("System.Int32&"), true);
Although it's impossible to "do" anything with this type in code, it seems that it is possible to emit it to assembly (after all ).
modified on Wednesday, December 10, 2008 12:23 PM
|
|
|
|
|
Hi,
could it be the "int32& pinned p" line is actually a mistake in the disassembly process, and
"int32* pinned p" is what is meant from the start? What does the disassembly show for your own code?
IMO you can force the GC to move things using a scenario like this one:
- create a class A that takes a lot of memory, say 50KB, but well below the "huge object" threshold (which is around 75KB IIRC).
- create a second class B that takes slightly more memory.
- instantiate a lot of objects A, keeping their references somewhere, say in a List, until allocating a few more would make you run out of memory.
- remove half (i.e.every second) of those objects
- now start instantiating the same number of objects from class B.
Such scenario is bound to call the GC, which will have to compact (i.e. move most of the A objects) to fill the order. You can fix your class A objects, or alternatively you can replace class A by an array of appropriate size.
|
|
|
|
|
Hi,
I'm afraid it's not a mistake of a compiler. Based on this article for example:
http://www.codeproject.com/KB/msil/ilassembly.aspx
It looks like it's just a type, now the question is, does it has some special meaning, especially when pinning objects in memory. Your method looks like it should work, I'll try it and do some tests as soon as I have few free minutes, which means now .
|
|
|
|
|
Sorry, I can't answer your question. That's the kind of question that you are only likely to get a proper answer from someone who worked at MS, and wrote portions of the CLR/C# compiler. (Do you have an MSDN license, try the MS managed forums)
All I can do is point out a reflector plugin I came across the other day: http://www.codeplex.com/reflectoraddins/Wiki/View.aspx?title=ReflectionEmitLanguage&referringTitle=Home[^]
Basically, it displays the C# code that you would need to write to output the same IL for the method.
Maybe it will help you figure out how to do what you are trying.
Good luck.
Simon
|
|
|
|
|
Well, I was hoping someone had similiar problem, that's why I asked here in first place . I've tried this plugin that you've recommened, but unfortunately without any success. This plugin just copy&paste type from exe, which produces line like that:
LocalBuilder p = gen.DeclareLocal(typeof(Int32&));
This isn't even proper c# statement hehe . So I guess, this path leads to the dead end.
|
|
|
|
|
Ravadre wrote: This isn't even proper c# statement hehe Smile. So I guess, this path leads to the dead end.
Oh well. I've not used it myself, I just remember seeing it and thinking it looked interesting while looking for a different plug-in. Sorry.
Good luck.
Simon
|
|
|
|
|
The bright side is that I didn't know that such plugin exists, and it is cool, it will be handy, that's for sure. So thanks for showing me it 
|
|
|
|
|
hi,
i'm would like to write a help to an application i've built
how can integrat the windows help in my app, and use a CHM file with it
THANKS
Have Fun
Never forget it
|
|
|
|