Sign in to follow this  
Followers 0
Guest deusieeee

Desktop Resolution?

10 posts in this topic

I was wondering how i could read the current desktop resolution // color depth?

Sleep(3000)
$array = WinGetClientSize ( "Program Manager" )
MsgBox(0,"", $array[0] & " " & $array[1])

would that work for resolution for say Win98 // me // 2000 // XP???

how would i get the color depth??

thanks,

-deusieeee- :D

Share this post


Link to post
Share on other sites



ok im using @DesktopWidth // @DesktopHeight

but im still stuck on getting the color depth.

thx

Share this post


Link to post
Share on other sites

ok please understand i am under windows 2000. so this may not work for windows 9x...

registry call

HKEY_CURRENT_CONFIG\System\CurrentControlSet\SERVICES

now here is what you have to do ok... min is an nvidia. so i cannot direct you to the name of the card you or someone else is using. now under these services should be two sub keys. should be names (VGASAVE) ignore that one that is windows default. the other kiey would be most likely the one that you are using for that computer. now under that key you will find another key names something like devie0 or some stuff. click on it and highlight it. off to the right look for a registry key that says (DefaultSettings.BitsPerPel) the number for the data is the color depth. 32 means true color, 16 means high color and so on... now remmber all this was done using regedit... so have fun... i hope this helps some... and under windows 98 read here...


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

how would i get the color depth??

thanks,

-deusieeee- :D

Someone will hopefully clean this up a bit. But here's my quick and dirty.

; RegKey to video card used as Video0 which should be main/default video card
$VideoCardTotalKey = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DeviceMap\Video", "\Device\Video0")

; Set results to an array split by \
$VideoCardTotalKeyArray = StringSplit( $VideoCardTotalKey, '\' )

; Total number of items in the array
$VideoCardTotalKeyArrayNumber = $VideoCardTotalKeyArray[0]


; Only concerned with last two keys.  Pick them up by using array total and array total minus one.
$VidString =  & $VideoCardTotalKeyArray[($VideoCardTotalKeyArrayNumber - 1)] _ 
               "\" & $VideoCardTotalKeyArray[$VideoCardTotalKeyArrayNumber]

; $VideoBits should = color depth in decimal value
$VideoBits = RegRead("HKEY_CURRENT_CONFIG\System\CurrentControlSet\Services\" & $VidString, "DefaultSettings.BitsPerPel")

MsgBox(4096, "Bits", $VideoBits)
Edited by randd

Raoul S. Duke: Few people understand the psychology of dealing with a highway traffic cop. Your normal speeder will panic and immediately pull over to the side. This is wrong. It arouses contempt in the cop-heart. Make the bastard chase you. He will follow.

Share this post


Link to post
Share on other sites

there is a UDF somewhere on these boards for checking color depth, I'm not going to search for it, but I know I read about it once...


"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

@emmanuel,

I searched for 16 bit and 32 bit and only found a few threads started non of which answered the question. So I wrote the above script. It works for me, but I'm not positive about the reg keys in non-W2K boxes. I can test the script when I get home, but conceptually I think I have it correct.

I'm hoping one of the wizards will step up and let me know if I'm totally off base or not.


Raoul S. Duke: Few people understand the psychology of dealing with a highway traffic cop. Your normal speeder will panic and immediately pull over to the side. This is wrong. It arouses contempt in the cop-heart. Make the bastard chase you. He will follow.

Share this post


Link to post
Share on other sites

@JdeB,

Should I be upgrading to bleeding edge?

Is there any chance you can gank the code for that little function and shove it here? I'd love to see if I'm even close.

I'll have to keep up on that topic... I didn't know Jon released new updates so frequently.


Raoul S. Duke: Few people understand the psychology of dealing with a highway traffic cop. Your normal speeder will panic and immediately pull over to the side. This is wrong. It arouses contempt in the cop-heart. Make the bastard chase you. He will follow.

Share this post


Link to post
Share on other sites

Should I be upgrading to bleeding edge?

Well you know the risk of Beta/Unstable releases.... :D

Is there any chance you can gank the code for that little function and shove it here?  I'd love to see if I'm even close.

The macro @DesktopDepth returns Depth of the desktop screen in bits per pixel.

I'll have to keep up on that topic... I didn't know Jon released new updates so frequently.

Just look at the v3 Developers forum for all Unstable release updates.

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Someone will hopefully clean this up a bit.  But here's my quick and dirty. 

; RegKey to video card used as Video0 which should be main/default video card
$VideoCardTotalKey = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DeviceMap\Video", "\Device\Video0")

; Set results to an array split by \
$VideoCardTotalKeyArray = StringSplit( $VideoCardTotalKey, '\' )

; Total number of items in the array
$VideoCardTotalKeyArrayNumber = $VideoCardTotalKeyArray[0]


; Only concerned with last two keys.  Pick them up by using array total and array total minus one.
$VidString =  & $VideoCardTotalKeyArray[($VideoCardTotalKeyArrayNumber - 1)] _ 
               "\" & $VideoCardTotalKeyArray[$VideoCardTotalKeyArrayNumber]

; $VideoBits should = color depth in decimal value
$VideoBits = RegRead("HKEY_CURRENT_CONFIG\System\CurrentControlSet\Services\" & $VidString, "DefaultSettings.BitsPerPel")

MsgBox(4096, "Bits", $VideoBits)
EDIT:

Here's a piece of code that works on XP (for those of us that didn't updated to the latest beta). My original code only worked on Win2k. It shouldn't take any skill to change to add a check to see if the user is using Win2k or WinXP.

; RegKey to video card used as Video0 which should be main/default video card
$VideoCardTotalKey = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DeviceMap\Video", "\Device\Video0")
; Set results to an array split by \
$VideoCardTotalKeyArray = StringSplit( $VideoCardTotalKey, '\' )
; Total number of items in the array
$VideoCardTotalKeyArrayNumber = $VideoCardTotalKeyArray[0]
; Only concerned with last two keys.  Pick them up by using array total and array total minus one.
$VidString =  $VideoCardTotalKeyArray[($VideoCardTotalKeyArrayNumber - 1)] & "\"
; $VideoBits should = color depth in decimal value
$VideoBits = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Control\VIDEO\" & $VidString & '\0000\', "DefaultSettings.BitsPerPel")
MsgBox(4096, "Bits", $VideoBits)

Raoul S. Duke: Few people understand the psychology of dealing with a highway traffic cop. Your normal speeder will panic and immediately pull over to the side. This is wrong. It arouses contempt in the cop-heart. Make the bastard chase you. He will follow.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0