#130855 - 2004-12-08 10:28 PM
How to find current display resolution
|
Ryan Dao
Fresh Scripter
Registered: 2003-03-09
Posts: 45
|
Hi,
Where in the registry is the current display resolution?
Thanks
|
|
Top
|
|
|
|
#130857 - 2004-12-08 10:37 PM
Re: How to find current display resolution
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,
See our script monitor.kix on our site. Also some UDF's are available on UDF forum f.e. ScreenRes. greetings.
|
|
Top
|
|
|
|
#130864 - 2004-12-09 08:59 PM
Re: How to find current display resolution
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4567
Loc: USA
|
This UDF will display the resolution of the Primary adapter on XP. Someone mind testing this on Windows 2000?
Code:
function resolution() Dim $MSInfoDir, $MSInfo, $MSInfoTemp, $MSInfoResolution, $fh $MSInfoDir='%commonprogramfiles%\Microsoft Shared\MSInfo\' $MSInfo=$MSInfoDir + 'msinfo32.exe' $MSInfoTemp=temp.txt $MSInfoResolution=@scriptdir + '\resolution.txt' if exist($MSInfoDir + $MSInfoTemp) del $MSInfoDir + $MSInfoTemp endif if exist($MSInfoResolution) del $MSInfoResolution endif shell '%comspec% /c "' + $MSINFO + '" /report ' + $MSInfoTemp + ' /categories +componentsdisplay' shell '%comspec% /c type "' + $MSInfoDir + $MSInfoTemp + '" > "' + $MSInfoResolution + '"' $fh=freefilehandle() if open($fh,$MSInfoResolution)=0 $line=readline($fh) while @error=0 and $found=0 if instr($line,"Resolution") $resolution=ltrim(split($line,"Resolution")[1]) $found=1 endif $line=readline($fh) loop $=close($fh) endif endfunction
|
|
Top
|
|
|
|
#130866 - 2004-12-09 09:37 PM
Re: How to find current display resolution
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4567
Loc: USA
|
Okay.. try now...
Code:
function resolution()
Dim $MSInfoDir, $MSInfo, $MSInfoTemp, $MSInfoResolution, $fh, $found
$MSInfoDir='%commonprogramfiles%\Microsoft Shared\MSInfo\'
$MSInfo=$MSInfoDir + 'msinfo32.exe'
$MSInfoTemp=temp.txt
$MSInfoResolution=@scriptdir + '\resolution.txt'
if exist($MSInfoDir + $MSInfoTemp)
del $MSInfoDir + $MSInfoTemp
endif
if exist($MSInfoResolution)
del $MSInfoResolution
endif
shell '%comspec% /c "' + $MSINFO + '" /report ' + $MSInfoTemp + ' /categories +componentsdisplay'
shell '%comspec% /c type "' + $MSInfoTemp + '" > "' + $MSInfoResolution + '"'
$fh=freefilehandle()
if open($fh,$MSInfoResolution)=0
$line=readline($fh)
while @error=0 and $found=0
if instr($line,"Resolution")
$resolution=ltrim(split($line,"Resolution")[1])
$found=1
endif
$line=readline($fh)
loop
$=close($fh)
endif
endfunction
|
|
Top
|
|
|
|
#130869 - 2004-12-09 10:25 PM
Re: How to find current display resolution
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4567
Loc: USA
|
... and unfortunately, it appears it does.
http://support.microsoft.com/?kbid=323209
|
|
Top
|
|
|
|
#130871 - 2004-12-10 08:00 PM
Re: How to find current display resolution
|
Ryan Dao
Fresh Scripter
Registered: 2003-03-09
Posts: 45
|
Awesome...Thank you everyone for your help. I will try all suggestions then update. Thanks again.
Ryan
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 483 anonymous users online.
|
|
|