|
hallo is it possible to fetch the actual native resolution or the resolution ratio of a LCD display attached to the system?
Eg.: i'd want my application to adapt differently if the LCD display is a 4:3 or a 16:9, etc., independently from the Windows' resolution
Thanks!
|
|
|
|
|
You could use System.Windows.Forms.Screen.PrimaryScreen.Bounds.Size .
|
|
|
|
|
That will get the bounds of the screen at its current resolution...but will it get the bounds of the screen at its native resolution? For example, if I have a 1920x1080 screen, but I am running it at 1600x1200...the ratio of 1600x1200 is a 4:3 ratio, but the screen itself is a 16:9 ratio. There is also the question of a screen with 1920x1200/2560x1600, which are both 16:10. I am not sure the .Bounds property will actually provide the right information.
|
|
|
|
|
|
Thanks for the reply, but the method returns the Windows resolution.
I'm looking for the *real* *physical* *native* resolution of the LCD display, the number of real pixels that the display is made of.
Eg. i need to know if the display is a 1280x800 or a 1280x1024, independently from the screen resolution currently setted in Windows.
I think that it is possible to read that value, since Windows itself can: actually, it does so the very first time you attach a different LCD display and Windows (XP) says "the screen now will be adjusted for a better visualization".
|
|
|
|
|
I'm not sure about it but I think that earlier Windows versions may not see the native resolution. The display driver used sees it, but that wold be driver specific.
However did you notice the post I replied to Jon Rista? Vista has a new WMI class definition to get the maximum sizes.
|
|
|
|
|
DirectX lets you enumerate valid display modes (see EnumDisplayModes[^]). Chances are that the highest one will be the native resolution - but I can't guarantee that.
|
|
|
|
|
Why would you want it to adapt to the screen and not the resolution? It will look stretched/smashed if you try to do that...
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
This is the interesting point
The user will not have access to Windows settings (mandatory design).
If he would attach a non-4:3 LCD to the machine, and Windows shouldn't adapt automatically to the native resolution, I should instead.
I agree that is a driver matter. Thanks for the replies.
|
|
|
|
|
I try to do following:
RegistryKey RegKey = Registry.ClassesRoot.CreateSubKey(".xxx");
but it gives the message "the access of registry key "HKEY_CLASSES_ROOT\.xxx" is denied",
what does mean?
thanks
|
|
|
|
|
It means you don't have access to that registry key. I was able to figure that out by reading this...
Seraph_summer wrote: "the access of registry key "HKEY_CLASSES_ROOT\.xxx" is denied"
|
|
|
|
|
It is most likely a permissions issue. Review the permissions on the registry key and hive.
|
|
|
|
|
I have known the problem, because I am using vista and I have to run VS as administrator!!
|
|
|
|
|
Hello,
I'm using the serial port control from .net 2.0 and an usb to serial(3 wires configuration) converter in order to communicate with a logic analyzer. The device makes a print screen, and I query it to send it over serial to my pc. If the image displayed on the device contains more information, such as fonts and various colors, I have some problems. Here is my scenario:
-The device sends the image in pcl format.
-I receive the bytes in the datareceived event and write them with a binary writer on to the disk. I've tried writing each time the event fired, as well as setting a threshold of 50000 (the image is about 30000) and a timer (I thought the operation with the disk made me lose some data) in order to write the entire buffer, after the transfer is made.
-I can appreciate if the data is correct by using a pcl to image converter, which displays the original image.
-For certain images, the converter fails to display the source, in that parses the image on 2 pages, an it displays a string of characters that it couldn't interpret from the file. (it displays it on the image).
-I know that the image is sent correctly because I used matlab to make the transfer, and it got the image ok.
-i've started modifying this solution:
http://msmvps.com/blogs/coad/archive/2005/03/23/SerialPort-_2800_RS_2D00_232-Serial-COM-Port_2900_-in-C_2300_-.NET.aspx[^]
I've read there are some problems with the serial port control, and used this to avoid it:
http://msdn.microsoft.com/en-us/magazine/cc301786.aspx[^].
I've written a small c program, which I wanted to include in my c# code, it sends the command, but when I poll portAddress + 5(the status register), it returns 0 or 0x60, but never a 0x01.
I've written a c++ (createfile,readfile) to communicate with the device, the device does not respond.
Yes,this is a school project, yes I'm on a tight schedule and i really need some help. Thank you.
P.S.I'm not doing it in matlab, because I want to continue extending the program in order to provide a virtual lab, accessible via internet.
For code requests, situations I have missed to ilustrate, please ask and debate.
My later edit: the pc sees the serial port on com12, due to the adapter and it seems that in c++ i have to write \\\\.\\com12 if com>10 as parameter for createfile. In c#, getports() return the com12 though.
Cosmin.
modified on Tuesday, February 3, 2009 2:19 PM
|
|
|
|
|
I've solved the problem. I found out that the issue was in the protocol I was using. As I've said before, I was using a 3 wire serial setup for communicating, and the device accepted xonxoff protocol or none. I thought it was best to use xonxoff, but it seems that the pc misinterprets some characters and I changed it over to none. Although there's no control over the communication, the image is sent correctly now.
Cosmin.
|
|
|
|
|
private delegate void _Post_Result(object[] data);
private void Post_Result(object[] data)
{
if (lvThreads.InvokeRequired)
{
_Post_Result upd = new _Post_Result(Post_Result);
this.lvThreads.Invoke(upd, new object[] { data });
}
else
{
ListViewItem lvitem = (ListViewItem)data[0];
this.lvThreads.Items[lvitem.Text].SubItems[1].Text = Convert.ToString(data[1]);
}
}
I am getting this error "Parameter count mismatch" in the bold line...
|
|
|
|
|
don234564 wrote: Parameter count mismatch
The error message always tells you the problem.
In this case, the number of parameters passed to the method is incorrect.
I don't know that method you're using, though, so I can't help you with that.
Kristian Sixhoej
"You can't undo the past... but you can certainly not repeat it." - Bruce Willis
|
|
|
|
|
Looks alright to me, I have to say. What is lvThreads?
Regards,
Rob Philpott.
|
|
|
|
|
don234564 wrote: new object[] { data }
data already is an object array, why create a new array holding this one array as its sole element?
BTW: there is no need to create the delegate over and over again, you can move the statement
_Post_Result upd = new _Post_Result(Post_Result); elsewhere (e.g. as a class member) and execute it only once.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Friday, June 10, 2011 11:38 AM
|
|
|
|
|
I think I must be missing something here - I can't see what's wrong with the code.
You create a new array holding the array as it's only element because that's the signature Control.Invoke expects. The array represents individual parameters, the fact there's only one and that it is itself an array is irrelevant.
But then, I think it should work so don't listen to me...
Regards,
Rob Philpott.
|
|
|
|
|
im confused either where im getting this wrong... anyone can try the code?
|
|
|
|
|
yes data is already an array. parameter in control.invoke refers to the number of parameters you pass this through in that case "upd" which is refered to Post_Results which contains only 1 param so thats the reason why you have to place the data into another array.
|
|
|
|
|
Never run into this situation but could you try what happens if you define the delegate as public.
Also as others pointed out, I don't see a reason to create a new array.
|
|
|
|
|
You have to create a new array because the outer array is the array of parameters TO PASS TO the called function, and the inner array IS the first parameter OF the called function. Since the called function takes an array as its first parameter...
|
|
|
|
|
Wouldn't casting work in this situation?
this.lvThreads.Invoke(upd, (object[])data);
|
|
|
|