The blue screen appears only for kernel-mode errors. Code that runs in user-mode (such as a Visual Basic application) is not going to generate a blue screen. It can never directly generate a system crash.
The only way to do this is to install a kernel-mode driver that can force the blue screen, which you then invoke indirectly from your user-mode code. You mentioned one way: configuring the keyboard driver to initiate a system crash under certain conditions. Another option is to create a kernel-mode driver of your own that calls the KeBugCheckEx
function (or equivalent), and then invoke this functionality from your VB application. For example, Mark Russinovich has written a little utility, NotMyFault (download here), that uses a helper kernel mode driver to force a crash condition.
A final option is to destabilize the operating system. I believe a simple way to do this is by forcibly killing the process “csrss.exe”. Last time I checked, this caused a BSOD. Obviously this requires administrative privileges. And I’m not sure if there are checks in place within the OS itself now that prevent this process from being killed; it is very likely. And if you are allowed to destroy the state of the machine permanently, you have a number of fun options: for example, trashing the HKLM key in the system registry.
That said, dare I inquire as to the utility of such a “feature”? Would you and/or your users be content just installing the Blue Screen of Death Screen Saver?
solved How to make a Visual Basics application that forces a bluescreen [closed]