VB °æ (¾«»ªÇø)

·¢ÐÅÈË: pxweb (ÀÏÅ£), ÐÅÇø: VisualBasic
±ê  Ìâ: ÓÃVBʵÏÖÔ¶³Ì¹Ø»ú  
·¢ÐÅÕ¾: ×Ï ¶¡ Ïã (Thu Nov 26 09:07:39 1998), ×ªÐÅ

1.ÏÂÔØhttp://202.99.168.12/~MrCool/vb/winexit.zip,»òÔÚ¼Çʱ¾ÖмÓÈëÒÔÏÂÎı¾,ÒÔwinexit.frmÃû´æÅÌ:

VERSION 5.00
Begin VB.Form WinExit 
BorderStyle = 3 'Fixed Dialog
Caption = "Shut Down Windows"
ClientHeight = 2865
ClientLeft = 1695
ClientTop = 2025
ClientWidth = 6165
Icon = "Windows Exiter.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
PaletteMode = 1 'UseZOrder
ScaleHeight = 2865
ScaleWidth = 6165
ShowInTaskbar = 0 'False
Begin VB.CommandButton Help 
Caption = "&Help"
Height = 375
Left = 3840
TabIndex = 8
Top = 2280
Width = 1095
End
Begin VB.OptionButton Logoff 
Caption = "&Close all programs and log on as a differnet user?"
Height = 255
Left = 840
TabIndex = 7
Top = 1680
Width = 4815
End
Begin VB.OptionButton MSDOS 
Caption = "Restart the computer in &MS-DOS mode?"
Height = 255
Left = 840
TabIndex = 6
Top = 1320
Width = 3615
End
Begin VB.CommandButton No 
Caption = "&No"
Height = 375
Left = 2640
TabIndex = 5
Top = 2280
Width = 1095
End
Begin VB.OptionButton Restart 
Caption = "&Restart the computer?"
Height = 255
Left = 840
TabIndex = 3
Top = 960
Width = 3495
End
Begin VB.OptionButton Shutdown 
Caption = "&Shut down the computer?"
Height = 255
Left = 840
TabIndex = 2
Top = 600
Value = -1 'True
Width = 3375
End
Begin VB.PictureBox Shutdownicon 
AutoRedraw = -1 'True
AutoSize = -1 'True
BorderStyle = 0 'None
Enabled = 0 'False
Height = 480
Left = 120
Picture = "Windows Exiter.frx":000C
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 1
Top = 240
Width = 480
End
Begin VB.CommandButton Yes 
Caption = "&Yes"
Default = -1 'True
Height = 375
Left = 1440
TabIndex = 0
Top = 2280
Width = 1095
End
Begin VB.Label Areyousurelabel 
Caption = "Are you sure you want to:"
Height = 255
Left = 840
TabIndex = 4
Top = 240
Width = 2895
End
End
Attribute VB_Name = "WinExit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' This project was written by JamesGuo.
' Contact me via Email: jamesguo@163.net or visit my homepage.
' http://vbheaven.yeah.net

Private Declare Function GetVersionEx& Lib "kernel32.dll" Alias "GetVersionExA" (lpStruct As OsVersionInfo)
Private Declare Function AbortSystemShutdown& Lib "advapi32.dll" Alias "AbortSystemShutdownA" (ByVal lpMachineName$)
Private Declare Function ExitWindowsEx& Lib "user32" (ByVal uFlags&, ByVal dwReserved&)
Private Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwData As Any) As Long
Private Type OsVersionInfo
dwVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatform As Long
szCSDVersion As String * 128
End Type

Private OsVer As OsVersionInfo
Private Const VER_PLATFORM_WIN32_WINDOWS = 1
Private Const VER_PLATFORM_WIN32_NT = 2
Private Const EWX_FORCE = 4 'constants needed for exiting Windows
Private Const EWX_LOGOFF = 0
Private Const EWX_REBOOT = 2
Private Const EWX_SHUTDOWN = 1
Private Const HELP_QUIT = 2
Private Const HELP_INDEX = 3
Private Const HELP_HELPONHELP = 4
Private Const HELP_PARTIALKEY = &H105


Function FileExists(Filename As String) As Boolean

Dim TempAttr As Integer
On Error GoTo ErrorFileExist 'any errors show that the file doesnt exist, so goto this label
TempAttr = GetAttr(Filename) 'get the attributes of the files
FileExists = ((TempAttr And vbDirectory) = 0)
GoTo ExitFileExist
ErrorFileExist:
FileExists = False 'return that the file doesnt exist
Resume ExitFileExist 'carry on with the code
ExitFileExist:
On Error GoTo 0 'clear all errors
End Function

Private Sub Help_Click()
Dim lRtn As Long 'declare the needed variables
lRtn = WinHelp(Me.hwnd, "C:\windows\help\windows.hlp", HELP_PARTIALKEY, "ShutDown")
End Sub

Private Sub No_Click()
Unload Me 'exit the program
End Sub

Private Sub Yes_Click()

If Shutdown.Value = True Then
lresult = ExitWindowsEx(EWX_SHUTDOWN, 0&) 'shut down the computer
ElseIf Restart.Value = True Then
lresult = ExitWindowsEx(EWX_REBOOT, 0&) 'restart the computer
ElseIf MSDOS.Value = True Then
lresult = FileExists(WinPath + "\Exit to dos.pif") 'make sure the pif file exists
If lresult = False Then 'the file could not be found
MsgBox "Cannot find " + WinPath + "\Exit To Dos.pif" + Chr(10) + Chr(10) + "Please make sure this file is in your Windows directory", vbCritical 'display an error message
Else 'otherwise
lresult = Shell(WinPath + "\Exit To Dos.pif", 1) 'execute the pif file
End If
Else
lresult = ExitWindowsEx(EWX_LOGOFF, 0&) 'close all programs and log on as a different user
End If
End Sub

2.ÔÚVB5.0Ï´ò¿ªÎļþWinexit.frm£¬½«Æä×÷³ÉActiveXÎĵµ.²½ÖèÈçÏ£º
  ´ò¿ª¡°Íâ½Ó³ÌÐò¡±²Ëµ¥ÏµÄ×Ӳ˵¥¡°Íâ½Ó³ÌÐò¹ÜÀíÆ÷¡±£»
  ÔÚ´ò¿ªµÄ´°¿ÚÖÐÑ¡ÖС°  VB ActiveX document migration wizard"
  ´ò¿ª¡°¹¤³Ì¡±²Ëµ¥ÏµÄ×Ӳ˵¥¡°¹¤³ÌÊôÐÔ¡±£¬ÔÚ´ò¿ªµÄ´°¿ÚÖÐÑ¡¡°Í¨Óá±±êÇ©£¬
  ÔÚ¡°¹¤³ÌÀàÐÍ¡±ÖÐÑ¡¡°ActiveX DLL¡±£¬ÔÚ¡°Æô¶¯¶ÔÏó¡±ÖÐÑ¡¡°ÎÞ¡±¡£

3.´ò¿ª¡°Îļþ ¡±²Ëµ¥ÏµÄ×Ӳ˵¥¡°Éú³Éwinexit.dll¡±£»ÔÚµÚ¶þÅŹ¤¾ßÀ¸ÖÐÑ¡ÖÖ
¡°VB ActiveX document migration wizard¡±£¬°´ÕÕÏòµ¼Éú³É.vbdÎļþ£»

4.ÖÆ×÷ÈçϵÄHTMLÎļþ£¬ÒÔexitwin.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="refresh" content="1;url=docwinexit.vbd">
<title>ExitWindows</title>
</head>
<body>
</body>
</html>

5.½«exitwin.html¿½Èë.vbdÎļþÏàͬµÄĿ¼£»

6.ÔÚIE4.0Ï´ò¿ªexitwin.html

  ÖÆ×÷Íê³É£¡Èç¹ûÄãÓÐÈκÎÎÊÌâ»ò¸ß¼û£¬ÇëÓÃE-Mail panxiang@263.netºÍÎÒÈ¡µÃÁªÏµ£¬
»¶Ó­Äã·ÃÎÊÎҵĸöÈËÖ÷Ò³.

--
¡ù À´Ô´:£®×Ï ¶¡ Ïã bbs.hit.edu.cn£®[FROM: 202.118.226.74]
[°Ù±¦Ïä] [·µ»ØÊ×Ò³] [Éϼ¶Ä¿Â¼] [¸ùĿ¼] [·µ»Ø¶¥²¿] [Ë¢ÐÂ] [·µ»Ø]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
Ò³ÃæÖ´ÐÐʱ¼ä£º2.373ºÁÃë