Rob van der Woude's Scripting Pages

News Archives 2024 Q1


[ Back to the current news page... ]


HasHardware.exe had another update (1.03): though elevated privileges are still preferred, with the new optional command line switches /C and /H you can use the program without elevated privileges.
You may get less details in verbose mode without elevated privileges.
• Oops (twice), two more updates for HasHardware.exe (1.05):


HasHardware.exe has been updated: in verbose mode, it will display a lot more monitor details.


HasHardware.exe is a new batch tool combining HasKeyboard.exe, HasMonitor.exe and HasMouse.exe.
Because it uses WMI's root/WMI namespace, it does require elevated privileges.


• After finding a reliable WMI query to find the actual number of connected mice, I updated HasMouse.exe once more (4.00).
This latest update can distinguish between USB, RS-232 (serial) and PS/2 mice.
Unfortunately, it does require elevated privileges, if that is not an option, use version 3.00 which is still included in the ZIP file.
• Now that mice can be counted reliably using WMI, a batch version using WMIC was the obvious next "project".


HasMonitor.exe is the lates addition to the HasHardware family.
As its name suggests, it checks the actual number of monitors connected at this very moment.
I tried using several Win32 API functions to achieve this, but in the end I found a really simple way to use WMI instead: Win32_DesktopMonitor's MonitorType property value will equal Default Monitor and its MonitorManufacture property will be empty for disconnected monitors.
Be warned that MonitorType may equal Default Monitor for a connected monitor, in that case HasMonitor.exe's optional /D switch can be used to correct the number.
The best way to avoid this is by installing the manufacturer's driver for the monitor.


• Since Pavel Pachobut's C# wrapper for GetRawInputDeviceList can be used to count the actual number of mice, instead of having to guess by counting the total number of mouse buttons, I used it to update HasMouse.exe once more.
Unlike HasKeyboard.exe, the updated HasMouse.exe cannot distinguish between USB and non-USB mice.
The program's return code now equals the actual number of mice detected, or -1 for (command line) errors.
The downloadable ZIP file contains versions 1.* and 2.* of HasMouse as well.

While at it, I also wrote HasHID.exe, which combines the functionality of HasKeyboard.exe and HasMouse.exe into a single executable.

Thanks Pavel


HasKeyboard.exe is a new batch tool, similar to HasMouse.exe, but using the Win32 API's RawInputDeviceEnumerator to count the actual number of keyboards available at this very moment.
By default it counts all keyboards, but optional command line switches allow you to count either USB keyboards only, or non-USB keyboards only.
Unlike WMI the result is not cached, and as far as I know this is the most reliable keyboard (and possibly mouse as well) detection available.
The code used is based on Pavel Pachobut's C# wrapper for GetRawInputDeviceList on GitHub, I just added the AllKeyboardsCount and OtherKeyboardsCount properties to its RawInputDeviceEnumerator class.

Thanks Pavel


HasMouse.exe had a minor update (1.01): if a mouse was detected, the result is shown in green instead of in red.
HasMouse.exe had another update (2.00): I found that, unlike my earlier assumptions, .NET's System.Windows.Forms.SystemInformation does return the actual number of mouse buttons, just like GetSystemMetrics does.
So I replaced the P/Invoke of GetSystemMetrics(43) by SystemInformation MouseButtons.
During testing the response times of the latest update were more or less equal to those of the old version if a mouse was detected, and slightly faster if no mouse was found.


GetDeviceClassGUID.bat has been updated:


• Health issues have kept me occupied for over 6 weeks, and may continue doing so for the near future.
For now I spend less time at my computer than I used to do, so it may take much longer before I reply to your mails.
HasMouse.exe is a new batch tool, using GetSystemMetrics to detect if there is a mouse available at this very moment.
Unlike WMI and SystemInformation, the result is not cached, and as far as I know this is the most reliable mouse detection available.
GetDeviceClassGUID.bat is a new progammers helper tool to find Windows' device class GUID(s) based on any device type found by DEVCON.
The batch file requires DeDup.exe and RxGrep.exe as well.


• I just added some PHP code to show the page load time at the bottom of each page.
The code was submitted by Ron on

print( "page loaded in " . number_format( microtime( true ) - $_SERVER["REQUEST_TIME_FLOAT"], 4 ) . " seconds" );

Thanks Ron
PDF Form Test has been updated again, it now recognizes Adobe Reader, Acrobat Standard and Pro, eXPertPDF, Foxit PDF Reader, Nitro PDF Reader and PDF-XChange Editor.
Besides, when printing the form, some additional debugging info will be printed.
• After 21 years, OpenAs.bat has been updated: it no longer requires a full path for the specified file.
The cost? It will open the file using its short 8.3 name.


• I wish you a happy 2024, may it turn out to be your best year so far.



Archived News pages
Archived news from 2023
Archived news from 2022
Archived news from 2021
Archived news from 2020
Archived news from 2019
Archived news from 2018
Archived news from 2017
Archived news from 2016
Archived news from 2015
Archived news from 2014
Archived news from 2013
Archived news from 2012
Archived news from 2011
Archived news from 2010
Archived news from 2009
Archived news from 2008
Archived news from 2007



page last modified: 2024-04-15; loaded in 0.0077 seconds