Abstract: Based on Delphi7.0 as a development platform, this paper gives the design methods and steps of two screen capture techniques in network monitoring software. This paper introduces how to monitor the picture of students ' computer monitor in the teaching of computer room in order to guarantee the quality and effect of teaching.
Introduction
With the rapid development of network technology, the use of computer network in the teaching of colleges and universities has been very common, but we found a problem in the teaching process, because the teacher is facing the students, and back to the student computer monitor, can not always view students computer monitor content, so, Some students in the teaching of stealing games, affecting the quality and effectiveness of teaching, therefore, the design of a network monitoring software, monitoring students computer, is very necessary. For this purpose, the system should have the following features:
(1) Teachers can cycle through the screen of the student computer display.
(2) Teachers can dynamically display the screen on a student's computer monitor.
(3) Teachers can use computers to send warning messages and control information to students.
(4) Students use the computer to automatically run the service-side monitoring program.
(5) In order to prevent the student to use the computer's service-side monitor program, the student discovers uses Ctrl+alt+del to close, must hide the program in the Ctrl+alt+del dialog box. Also, you should hide the program's buttons on the taskbar.
Based on the application practice, this paper introduces two methods that can be used to implement screen capture technique in Delphi7.0.
Program implementation
(1) The difficulty of grabbing the screen image is two: one is how to capture the handle of the screen, and the other is how to get the image of the screen after the screen handle is known. Borland's designers use canvas (Tcanvas) objects to encapsulate most of the graphics output features of Windows, which can be used to interact with Windows ' screens more intuitively without worrying about the headaches of Windows API functions. The following procedure is specified:
Procedure Tform1.timer1timer (sender:tobject);//grab the screen and save it in the image control
var
fullscreen:tbitmap;
Fullscreencanvas:tcanvas;
Dc:hdc;
begin
Fullscreen:=tbitmap.create;
//Create a bitmap to hold the image
fullscreen.width:=screen.width;
Fullscreen.height:=screen. Height;
Dc:=getdc (0);//Get the DC of the screen, parameter 0 refers to the screen
Fullscreencanvas:=tcanvas.create;
//Create a Canvas object
FULLSCREENCANVAS.HANDLE:=DC;
Fullscreen.Canvas.CopyRect (Rect (0,0,screen. Width,screen. Height),
Fullscreencanvas,rect (0,0,screen.width,screen.height));
//Copy the entire screen to bitmap
Fullscreencanvas.free;
//Release Canvas object
ReleaseDC (0,DC);//release DC
//*******************************
Image1.picture.bitmap:=fullscreen;//Copy images assigned to image Object
Image1. Width:=fullscreen. Width;
Image1. Height:=fullscreen. Height;
Fullscreen.free;//Release bitmap
Form1. Windowstate:=wsnormal;//Restore window state
Form1.show;//Display window
MessageBeep (1);//beep call, the report image has been intercepted.
End;
(2) Delphi's third-party control, Screencapture, is a good free control that can easily crawl any size (full screen of course), anywhere on the screen, set the shape of the image, and what mode to use. The following describes the use of Tcmwindow mode, using very simple, the use of the effect can be compared with the famous capture software SnagIt32.
Procedure Tform1.btnstartclick (Sender:tobject);
Begin
Screencapture1.start;//Start
End
This event occurs when the capture screen is successful
Procedure Tform1.screencapture1capture (SENDER:TOBJECT;BITMAP:TBITMAP);
Begin
Resizing the scrolling window to fit the size of the intercepted image
Scrollbox1.horzscrollbar.range:= Image1.width;
Scrollbox1.vertscrollbar.range:= Image1.height;
End
Procedure Tform1.formcreate (Sender:tobject);
Begin
Load Entntacp.dll File
Btnstart.enabled:= screencapture1.dllavailable;
Display version Information
caption:= ' screen capture software ' + screencapture1.version;
End
This event occurs when there is not enough memory to support intercepting the screen
Procedure Tform1.screencapture1error (Sender:tobject);
Begin
Messagedlg (' An error occurred during screen capture! Please close other applications to get more memory resources. ', mterror,[mbok],0);
End
This event occurs when the user presses the "ESC" key, which cancels the screen capture.
Procedure tform1.screencapture1usercancelled (Sender:tobject);
Begin
Messagedlg (' User cancels screen capture. ', mtinformation,[mbok],0);
End
Conclusion
By debugging and running the above two kinds of program code, the method of using third party control is easier to design and implement, and the program code in this paper is debugged in Win2000 and Delphi7.0 environment.
Http://blog.sina.com.cn/s/blog_562349090100zkvs.html
Implementation of Delphi screen capture technology