How to run an application ( .exe file) from visual basic ? ?

i've built a console application (.exe) using c++ . Now I want to run this application by visual basic code.

I used the following method

Public 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 Sub Command1_Click()

ShellExecute 0, vbNullString, "c:\poreflow.exe", bNullString, vbNullString, 1

End Sub

This method sometimes works and sometimes dose not work. however when the vb can not run the application i can run it by directly clicking on it ( i.e. the .exe file is OK ) .

any suggestion ?

2 Answers

  • cura
    Lv 4
    4 years ago

    you will desire to be certain the objective laptop has the superb suited version of the .internet framework put in. you will ought to verify to work out what version of the framework is centred via the compiled utility, acquire that deploy, and deploy it on the objective laptop. as quickly as that has been completed, it might run on the different laptop, as long as there are not the different lacking dependencies.

  • Anonymous
    1 decade ago

    Re- run the code through your program then restart ur computer if that doesn't work your code is messed up scan through it and find and fix!

Still have questions? Get your answers by asking now.