⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form2.frm

📁 这个源代码主要模仿了一个类似 深度操作系统安装程序中的一个软件自动安装管理器AutoIt v3
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form2 
   Caption         =   "Form2"
   ClientHeight    =   3090
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4680
   LinkTopic       =   "Form2"
   ScaleHeight     =   3090
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   660
      Left            =   1050
      TabIndex        =   0
      Top             =   960
      Width           =   1635
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

''**************************************
''Windows API/Global Declarations for :Sh
''     ellExecuteWait
''**************************************
'    Private Const INFINITE As Long = &HFFFFFFFF
'    Private Const SEE_MASK_FLAG_NO_UI As Long = &H400
'    Private Const SEE_MASK_NOCLOSEPROCESS As Long = &H40
'
'Private Type SHELLEXECUTEINFO
'    cbSize As Long
'    fMask As Long
'    hWnd As Long
'    lpVerb As String
'    lpFile As String
'    lpParameters As String
'    lpDirectory As String
'    nShow As Long
'    hInstApp As Long
'    lpIDList As Long
'    lpClass As String
'    hkeyClass As Long
'    dwHotKey As Long
'    hIcon As Long
'    hProcess As Long
'    End Type
'
'
'Private Declare Function WaitForSingleObject Lib "Kernel32.dll" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
'
'
'Private Declare Function GetLastError Lib "Kernel32.dll" () As Long
'
'
'Private Declare Function ShellExecuteEx Lib "Shell32.dll" (ByRef lpExecInfo As SHELLEXECUTEINFO) As Long
''**************************************
' Name: ShellExecuteWait
' Description:This code uses simple API
'     to launch a program or a document but th
'     is code also awaits until the process ha
'     s ended so you can force the user to do
'     something before proceeding (as setup wi
'     zards does). The procedure supports comm
'     and line parameters, a working folder an
'     d showing options.
'It 's so simple and I couldn't find it on this site so I posted it.
' By: BioHazardMX
'
'
' Inputs:None
'
' Returns:The code returns the hInstance
'     of the new process if sucessfull or the
'     error code if something gone wrong.
'
'Assumes:None
'
'Side Effects:None
'This code is copyrighted and has limite
'     d warranties.
'Please see http://www.Planet-Source-Cod
'     e.com/xq/ASP/txtCodeId.67825/lngWId.1/qx
'     /vb/scripts/ShowCode.htm
'for details.
'**************************************

'With this code you'll be able to a laun
'     ch a program or open a document as if yo
'     u were using the "ShellExecute" function
'     , but your program will await until the
'     opened process has ended (as installers


'     does)
    'Code by BioHazardMX
    'Add the following code to a module
    Private Const INFINITE As Long = &HFFFFFFFF
    Private Const SEE_MASK_FLAG_NO_UI As Long = &H400
    Private Const SEE_MASK_NOCLOSEPROCESS As Long = &H40


Private Type SHELLEXECUTEINFO
    cbSize As Long
    fMask As Long
    hWnd As Long
    lpVerb As String
    lpFile As String
    lpParameters As String
    lpDirectory As String
    nShow As Long
    hInstApp As Long
    lpIDList As Long
    lpClass As String
    hkeyClass As Long
    dwHotKey As Long
    hIcon As Long
    hProcess As Long
    End Type


Private Declare Function WaitForSingleObject Lib "Kernel32.dll" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long


Private Declare Function GetLastError Lib "Kernel32.dll" () As Long


Private Declare Function ShellExecuteEx Lib "Shell32.dll" (ByRef lpExecInfo As SHELLEXECUTEINFO) As Long


Private Function ShellExecuteWait(ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long)
    Dim lReturn As Long, lResult As Long
    Dim tExecuteInfo As SHELLEXECUTEINFO
    'Fill the SHELLEXECUTEINFO structure
    tExecuteInfo.cbSize = Len(tExecuteInfo)
    tExecuteInfo.fMask = SEE_MASK_NOCLOSEPROCESS
    tExecuteInfo.hWnd = hWnd
    tExecuteInfo.lpVerb = lpOperation
    tExecuteInfo.lpFile = lpFile
    tExecuteInfo.lpParameters = lpParameters
    tExecuteInfo.lpDirectory = lpDirectory
    tExecuteInfo.nShow = nShowCmd
    'Call the API with the specified paramet
    '     ers
    lReturn = ShellExecuteEx(tExecuteInfo)
    If lReturn = 0 Then lReturn = GetLastError Else lReturn = tExecuteInfo.hInstApp
    'If there's a new process wait while it
    '     terminates


    If tExecuteInfo.hProcess <> 0 Then
        lResult = WaitForSingleObject(tExecuteInfo.hProcess, INFINITE)
    End If
    'Return the ShellExecuteEx return value
    ShellExecuteWait = lReturn
End Function
'And the following code to a form. Also,
'     you must add a CommandButton named "Comm
'     and1"


Private Sub Command1_Click()
    'Hide the window
    WindowState = vbMinimized
    'Execute the Notepad and wait for termin
    '     ation
    Call ShellExecuteWait(hWnd, "open", "C:\Windows\Notepad.exe", "", "", vbNormalFocus)
    'Show the window
    WindowState = vbNormal
End Sub
        

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -