Source: http://www.111cn.net/asp/3/35f5b04c0c9f40c9f03a1b56d641ac3f.htm
The server script must call the win API interface to control the command mode of some switches. Let's look at an ASP interface to call the function of switching the com instance.
ASP calls the system API through this component, and then operates according to different restart and shutdown methods!
Next, let's talk about the creation of COM, and create a new project in VB, of courseAceivex DLLOf!
1) First modify the project properties, change the project name to System in the Project Properties window, change the module name to Contral in the class Module window, and save the project;
2) then add a module to declare the required API and constant! Below is the content in the module!
Private Declare Function Exitwindowsex Lib " USER32 " ( Byval Uflags As Long , Byval Dwreserved As Long ) As Long
3) enter the following in the class module:Code:
Public Function Reboot (Atype As Variant)
T & = Exitwindowsex ( 1 , Atype)
End Function
This function needs to input a parameter to control the startup mode, which is from ASPProgram!
Compile the code above, save the project, and compile the project as system. dll. Write the ASP program below!
The code in ASP is very simple:
< %
AType = Request ( " AType " )
Set Sys = Server. Createobject ( " System. Contral " )
SYS. Reboot (Atype)
% >
**************************************** ***
Author missed: you must first register the DLL file (input in cmd)
Register the command: regsvr32 c: \ system. dll
Uninstall the command: regsvr32/U c: \ system. dll
If the DLL is not registered, an error is reported. In set sys = server. Createobject ("system. contral "),
**************************************** ***
The Atype can be shut down using 0, 1, 2, 1, and 4, and 2 for restart. After writing, execute ASP!