从Visual Basic 6执行.exe [英] Executing .exe from Visual Basic 6

查看:90
本文介绍了从Visual Basic 6执行.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Visual Basic的新手.我正在尝试从VB执行.exe文件.但是我没有得到输出.我的.exe具有命令行参数.以下是我的代码

I'm new to visual basic. I'm trying to execute .exe file from VB. But I'm not getting the output. My .exe is having command line args. Following is my code

Private Sub Command1_Click()

    Shell "D:\FEP\extractFEPData.exe data.txt", vbNormalFocus

End Sub

在cmd提示符下如果我给出命令extractFEPData.exe data.txt,它正在解析文件.但是在VB中,单击命令按钮后没有任何反应.

In cmd prompt If I give command extractFEPData.exe data.txt It is parsing the file. But in VB after clicking command button nothing happens.

请帮助我.

推荐答案

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _
                    ByVal hwnd As Long, _
                    ByVal lpOperation As String, _
                    ByVal lpFile As String, _
                    ByVal lpParameters As String, _
                    ByVal lpDirectory As String, _
                    ByVal nShowCmd As Long) As Long

Private Const SW_HIDE As Long = 0

Private Const SW_SHOWNORMAL As Long = 1

Private Const SW_SHOWMAXIMIZED As Long = 3

Private Const SW_SHOWMINIMIZED As Long = 2


Private Sub Label1_Click()

    ShellExecute Me.hwnd, "Open", "G:\PN Technologies\VB\Krishna & Co\KrishnaCo.exe", vbNullString, "C:\", SW_SHOWNORMAL

End Sub

这篇关于从Visual Basic 6执行.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆