This example mainly realizes the function that VB calls the external EXE program to run, this is mainly uses the Shell function to execute, the shell function is mainly used to open an external exe executable file, for example, in sub module: Shell "Notepad", Vbnormalfocus, the representative to run Notepad in normal mode, Vbnormalfocus is the shell parameters, meaning normal mode, of course, it also has vbmaximizedfocus maximize mode, Vbminimizedfocus minimized mode, Vbhide hidden mode, such as a variety of operating methods can be selected.
The specific code examples and comments are as follows:
VERSION 5.00
Begin VB. Form Form1
Caption = "Form1"
clientheight = 3030
clientleft =
ClientTop = 450
clientwidth = 4560
linktopic = "Form1"
ScaleHeight = 3030
scalewidth = 4560
startupposition = 3 ' window default
end Attribute vb_name = "Form1"
attribute Vb_globalnamespace = False
attribute vb_creatable = False
Attribute Vb_predeclaredid = True
attribute vb_exposed = False
Option Explicit
Private Sub Form_Load () C36/>shell "Notepad", Vbnormalfocus
' Shell function can be used to run an external executable file
' its parameters are: program name (if that program is in different folders, and not system files, you need detailed path), Operation mode
' assuming you want to run the ABC.EXE of the C-packing directory, the first parameter requires: ' C:\\ABC. EXE "
' incidentally: if there are spaces in the path or file name, you have to add double quotes on both sides of the path (it is recommended to add double quotes, regardless of whether there are any spaces), like this:" "" C:\\1 2.exe "" "
' second parameter commonly used parameters are: Vbnormalfocus Normal mode, vbMaximizedFocus maximized mode, vbminimizedfocus minimized mode, vbhide hidden mode end
Sub
This program will open the Windows Notepad program directly, interested readers can try to open other executable program test run effect, or make personalized changes to achieve richer functionality.