Home > Software engineering >  For help, a mouse and keyboard without operation of automatic shutdown scripts
For help, a mouse and keyboard without operation of automatic shutdown scripts

Time:10-11

First of all thank you for your help, want to use VB script implementation, mouse and keyboard to detected within a specified period without operation shutdown command, and dialog message is turned off after 10 minutes, in the dialog box is detected during the keyboard mouse operation, the end of the shutdown command and test again, thank you, thank you, thank you, really don't want to use the software

CodePudding user response:



How To Create a Screen Saver in Visual Basic
The Last reviewed: September 13, 1996
The Article ID: Q146907
The information in this article applies to:
- Standard, Professional, and Enterprise Editions of Microsoft

Visual Basic, 16 - bit, for Windows, version 4.0



The SUMMARY
You can create a Windows screen saver with Visual Basic by following the guidelines listed below. The clear that both please note that this article gives only a very rough outline of what You should do for a robust screen saver. These are general guidelines only.



MORE INFORMATION
Follow these guidelines when creating a Windows screen saver with Visual Basic:

In the File Make EXE File dialog, insert the string SCRNSAVE: (In upper case) at the beginning of the Application Title. For example:
SCRNSAVE: Flying Fish.

In the File Make EXE File dialog, specify the program File name extension. As home SCR. EXE.
Locate the. SCR program file in the \ WINDOWS directory.
Difference your form the following property Settings so that it occupies the - screen and does not have a title bar:

Caption="" (no Caption)
ControlBox=False
MaxButton=False
MinButton=False
WindowState=2 (maximized)


Add code to all MouseMove, MouseDown, and KeyDown event handlers that exit the program. Because Visual Basic may invoke the MouseMove event when the form is first the loaded, you must write code to ignore the first MouseMove event. The following MouseMove code avoids the an an artifact event that occurs when the application is first activated or when the application is running and another instance starts (causing loss of focus) and then quits (restoring focus) :


Private Sub Form_MouseMove (Button As an Integer, Shift the As an Integer, _
As Single X, Y As Single)
The Static count As Integer
If the count & gt; 2 Then
End
The Else
The count=count + 1
End the If
End Sub

This gives you a bit of slack when it comes to an artifact MouseMove
Events. You will want to do something similar with the MouseDown and
KeyDown events.


Preventing Multiple Launches
Windows usually launches the screen saver program multiple times. To prevent more than one copy of your screen saver from running, add the following statements To the Form_Load event handler, or Sub Main if 2:


Private Sub Form_Load ()
If the App. PrevInstance Then
End
End the If
End Sub


There is no reason to attempt to restore the previous instance of the screen saver as the active window because it will become the active window when the new instance ends. All you have to do is the terminate the when you see another instance running.
To prevent multiple instances of the application from running as well as To keep the application running, you should move the code from the Form_Load () To a Sub Main (). Then set the project 's Startup Form Option To Sub Main (). Setting the project To begin processing at Sub Main is done on the project TAB which is part of the Options... Under the Tools menu. For example:


Public Sub Main ()
If App. PrevInstance Then 'If already running, the end of the application. The
End
The Else
Form1. Show 1 'Show the screen saver form.
End the If
End Sub


Launching the Screen Saver
Windows takes care of launching the Screen Saver. It keeps track of the system idle time and launches the Screen Saver program. You can use a timer control to periodically draw graphics on the form.

Screen savers are selected and configured from the Windows Control Panel in the Desktop dialog. The Screen saver section of this dialog has a button labeled Setup that invokes the Screen saver program with the command line option/c. the When your program is invoked with this option, you can display a configuration form to allow the user to select Settings to the as speed, number of objects, colors, and so on. The Detect the/c command line parameter by checking the command $function. For example:


Private Sub Form_Load ()
If the Command $="/c" Then
FrmConfig. Show 'Display configuration form.
Unload Me 'Bypass regular form.
End the If
End Sub


When Windows launches the screen saver, it usually specifies the command line option/s.


Possible Improvements
You may also want your program to appear on top of all other Windows by making it a TOPMOST window.

For additional information, both please see the following article (s) in the Microsoft Knowledge Base:


The ARTICLE - ID: Q84251
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • VBA
  • Related