如何使用代码查看显示器的分辨率
#! perl use Win32::OLE( 'in' ); use constant wbemFlagReturnImmediately => 0x10; use constant wbemFlagForwardOnly => 0x20; $computer = "."; my $objWMIService = Win32::OLE->GetObject( "winmgmts://$computer/root/CIMV2" ) or die "WMI connection failed.\n"; my $colItems = $objWMIService->ExecQuery( "SELECT * FROM Win32_DisplayConfiguration", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly ); foreach my $objItem ( in $colItems ) { print "Device Name : " . $objItem->{ DeviceName } . "\n"; print "Pels Width : " . $objItem->{ PelsWidth } . "\n"; print "Pels Height : " . $objItem->{ PelsHeight } . "\n"; print "Bits Per Pel : " . $objItem->{ BitsPerPel } . "\n"; print "Display Frequency : " . $objItem->{ DisplayFrequency } . "\n"; print "\n"; }
日期:2020-04-11 23:04:31 来源:oir作者:oir