An example of a monitor-VB programming to the computer

zhaozj2021-02-17  48

An example of a monitor to the computer - VB program ------------------------------------- ----------------------------------------- When you are not next to your machine, Will you worry that someone runs a program on your machine, bringing damage to your machine; or a child "Monkey" on your computer. Do you want to design a monitoring of a monitoring system, you can find out which improper programs run on your machine, or immediately force the game immediately when you have a child playing games on your machine. After reading this article, you can do it. First, set the ONTIMER event to implement the monitoring system, first of all, the ONTIMER event is that the program is going to "check" every other time in the current system is running. You can load the Timer control, set the interval property as "60000", so that the system will "check" every 1 minute, which is currently running. If you think the interval is too short, you can use the following code: private sub timer1_timer () Dim n as integer n = n 1 if n = 2 THEN "Check" 'This is set to 2 minutes, you can change your End Sub yourself How to monitor the operation of the monitoring system how to "check" what procedures in the current system are running. Method 1: We know that the Windows program is basically run in the form of a window. Each program corresponds to a main window and a number of sub-windows. We only use the API function getWindow to get the handle of the main window of each program with the API function GetWindow. HWND, then Use the API function getWindowText to get the title of these windows, you can judge which programs are running. Method 2: Use the API function FINDWINDOW to find us directly here to use the method 2 (relatively simple). 3. Close the program to find an inappropriate program, close it, you can use the API function PostMessage. Fourth, a program example is given below, which is composed with VB 5.0. This program "checks" every 2 minutes. If you run a "mine", "Red Heart Wars" and other games, you will force it to turn off it and issue a warning. The specific program code is as follows: 1. Establish a dialog-based application, the title "System Monitor", loads 2 CommandButton controls, the CAPTION attribute is: "Start monitoring", "program end".

转载请注明原文地址:https://www.9cbs.com/read-29674.html

New Post(0)