Проблема с запуском exe файлов - VB

Узнай цену своей работы

Формулировка задачи:

Проблема заключается в следующем....... Я хочу сделать некую форму, которая будет содержать, ну скажем, одну кнопку. И по нажатию на эту кнопку должен запускаться exe файл. Файл типа exe SFX-архива, либо exe файл программы написаной на VB. Подскажите пожалуйста програмный код!!! Зарание спасибо

Решение задачи: «Проблема с запуском exe файлов»

textual
Листинг программы
Option Compare Database
Option Explicit
 
Public Const SW_HIDE = 0
Public Const SW_NORMAL = 1
Public Const SW_SHOWMINIMIZED = 2
Public Const SW_SHOWMAXIMIZED = 3
Public Const SW_MAXIMIZE = 3
Public Const SW_SHOW = 5
Public Const SW_MINIMIZE = 6
Public Const SW_RESTORE = 9
Public Const SW_SHOWDEFAULT = 10
Public Const GW_HWNDNEXT = 2
Private Const WM_QUIT = &H12
 
Public Type PROCESS_INFORMATION
    hProcess As Long
    hThread As Long
    dwProcessId As Long
    dwThreadId As Long
End Type
 
Public Type STARTUPINFO
    cb As Long
    lpReserved As String
    lpDesktop As String
    lpTitle As String
    dwX As Long
    dwY As Long
    dwXSize As Long
    dwYSize As Long
    dwXCountChars As Long
    dwYCountChars As Long
    dwFillAttribute As Long
    dwFlags As Long
    wShowWindow As Integer
    cbReserved2 As Integer
    lpReserved2 As Long
    hStdInput As Long
    hStdOutput As Long
    hStdError As Long
End Type
 
Public Declare Function SetWindowText& Lib 'user32' Alias 'SetWindowTextA' (ByVal hwnd As Long, ByVal lpString As String)
 
Public Declare Function GetParent Lib 'user32' (ByVal hwnd As Long) As Long
 
Public Declare Function GetWindow Lib 'user32' (ByVal hwnd As Long, _
        ByVal wCmd As Long) As Long
 
Public Declare Function CloseWindow Lib 'user32' (ByVal hwnd As Long) As Boolean
 
Declare Function SetFocusAPI Lib 'user32' Alias 'SetFocus' _
                                 (ByVal hwnd As Long) As Long
 
Declare Function CloseWindowAPI Lib 'user32' Alias 'DestroyWindow' _
                                 (ByVal hwnd As Long) As Long
 
Public Declare Function GetWindowHandle Lib 'user32' (ByVal hwnd As Long) As Long
 
Public Declare Function PostMessage Lib 'user32' Alias 'PostMessageA' _
                    (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal _
                    lParam As Long) As Long
 
Private Declare Function CreateProcess Lib 'kernel32' _
   Alias 'CreateProcessA' _
   (ByVal lpApplicationName As String, _
   ByVal lpCommandLine As String, _
   lpProcessAttributes As Any, _
   lpThreadAttributes As Any, _
   ByVal bInheritHandles As Long, _
   ByVal dwCreationFlags As Long, _
   lpEnvironment As Any, _
   ByVal lpCurrentDriectory As String, _
   lpStartupInfo As STARTUPINFO, _
   lpProcessInformation As PROCESS_INFORMATION) As Long
 
Public Declare Function FindWindow Lib 'user32' Alias 'FindWindowA' _
                                    (ByVal lpClassName As String, _
                                    ByVal lpWindowName As String) _
                                    As Long
   
 
Private Declare Function OpenProcess Lib 'kernel32.dll' _
        (ByVal dwAccess As Long, _
        ByVal fInherit As Integer, _
        ByVal hObject As Long) As Long
 
Private Declare Function TerminateProcess Lib 'kernel32' _
        (ByVal hProcess As Long, _
        ByVal uExitCode As Long) As Long
   
Private Declare Function GetExitCodeProcess Lib 'kernel32' _
        (ByVal hProcess As Long, lpExitCode As Long) As Long
 
Private Declare Function CloseHandle Lib 'kernel32' _
        (ByVal hObject As Long) As Long
   
Private Declare Function WaitForSingleObject Lib 'kernel32' (ByVal _
        hHandle As Long, ByVal dwMilliseconds As Long) As Long

ИИ поможет Вам:


  • решить любую задачу по программированию
  • объяснить код
  • расставить комментарии в коде
  • и т.д
Попробуйте бесплатно

Оцени полезность:

15   голосов , оценка 4.133 из 5