This article mainly introduces the creation of an ASP script component to realize server restart. The component calls the system API for operation. Friends who need it can refer to it.
As we all know, it is impossible to restart the server by using ASP directly. At this time, we need to create a component to implement the function. ASP calls the system API through this component, and then operates according to different restart and shutdown methods!
Let’s talk about the production of COM first, and build a new project in VB, of course, from AceiveX dll.
1) First modify the project properties, change the project name to system in the project properties window, change the module name to contrast in the class module window, and save the project;
2) Then add a module to declare the API and constants to be used. The following is the content in the module.
Declare Function ExitWindowsEx Lib user32 (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
3) Enter the following code in the class module:
?
- PublicFunctionreboot(atypeAsVariant)
- t&=ExitWindowsEx(1,atype)
- EndFunction