# how to execute an exe file from Visual Basic 6.0



## redhat (Mar 13, 2007)

Hi friends, 
    I am making a progam in VB. I need to execute an exe application that I made in VB. I need to execute it since, adding the source for 10 apps into one, is very difficult and will hog system memory. So, I want to know how to execute an exe file from an app made in VB 6.0. I am not very familiar with API's, but if you tell me the process, I will easily understand it.
Thank You in advance


----------



## nileshgr (Mar 13, 2007)

redhat said:
			
		

> Hi friends,
> I am making a progam in VB. I need to execute an exe application that I made in VB. I need to execute it since, adding the source for 10 apps into one, is very difficult and will hog system memory. So, I want to know how to execute an exe file from an app made in VB 6.0. I am not very familiar with API's, but if you tell me the process, I will easily understand it.
> Thank You in advance


Wait for some VB ppl. And ur name is redhat but ur logo is not redhat!


----------



## abhijangda (Mar 14, 2007)

Hey friend tell me which type of project you want to make. Post here so that I can easily help you.


----------



## redhat (Mar 14, 2007)

I want to execute a particular exe file when the user selects an option from the menu. These are just add-ons and are not related to the program itself.


----------



## Kiran.dks (Mar 14, 2007)

redhat said:
			
		

> Hi friends,
> I am making a progam in VB. I need to execute an exe application that I made in VB. I need to execute it since, adding the source for 10 apps into one, is very difficult and will hog system memory. So, I want to know how to execute an exe file from an app made in VB 6.0. I am not very familiar with API's, but if you tell me the process, I will easily understand it.
> Thank You in advance



Simple. Execute the exe file directly from Command line. Use shell or ShellExecute. See that you give the exact location of the exe.


----------



## sakumar79 (Mar 14, 2007)

Hope this helps: *www.dreamincode.net/code/snippet276.htm

Arun


----------



## redhat (Mar 17, 2007)

> Hope this helps: *www.dreamincode.net/code/snippet276.htm
> 
> Arun



Thanks a lot,
It worked well for me
__________
Hi!
I am having a problem in using the "%Systemroot%" to refer to the "C"\Windows" directory.
I used to following code as suggested by sakumar79:

```
Dim RetVal
RetVal = Shell("%Systemroot%\System32\calc.exe", 1)
```
Please tell me where am I wring???


----------



## sakumar79 (Mar 17, 2007)

Try
Dim RetVal
RetVal = Shell(""%Systemroot%\System32\calc.exe"", 1)

Or
Dim winPath as string
Dim RetVal
winPath = Environ$("SystemRoot")
RetVal = Shell(winPath & "\System32\calc.exe"", 1)

Arun


----------



## redhat (Mar 17, 2007)

Thanks a lot sakumar79


----------

