VB using Shell function to open external EXE program implementation method _VB

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.