-
How To Lunch exe program from vb project in any PC
Hello Guys i want to make Project filled with exe files can any one use it in any pc iam using vb2010 Express
Any Solution?
-
Re: How To Lunch exe program from vb project in any PC
I think you need to provide a more detailed explanation of what you're trying to
-
Re: How To Lunch exe program from vb project in any PC
If all you're asking is how to run a program from code then the answer is to call Process.Start.
-
1 Attachment(s)
Re: How To Lunch exe program from vb project in any PC
Quote:
Originally Posted by
jmcilhinney
I think you need to provide a more detailed explanation of what you're trying to
Look! i need to make program which has a collection for programs exe if the user click in a button the program Open in any pc
i try this code BUt it open in my pc only if i used in any pc Error Appear
HTML Code:
Process.Start("C:\path_to\myapp.exe")
Like that program when i click on the Run Beethink Setup Program Appear and the folder of program have the setup exe file
Attachment 133053
-
Re: How To Lunch exe program from vb project in any PC
I think you need to use a bit of common sense here. That code is going to work on any machine as long as the app you specify to run exists. If it doesn't exist then obviously it can't run. Unless you can provide some meaningful information about the error that suggests otherwise, I can only assume that the program you're specifying doesn't exist.
-
Re: How To Lunch exe program from vb project in any PC
Quote:
Originally Posted by
jmcilhinney
I think you need to use a bit of common sense here. That code is going to work on any machine as long as the app you specify to run exists. If it doesn't exist then obviously it can't run. Unless you can provide some meaningful information about the error that suggests otherwise, I can only assume that the program you're specifying doesn't exist.
Bro How this code will Work if the Onther user dont have the Path file on his Pc
-
Re: How To Lunch exe program from vb project in any PC
Quote:
Originally Posted by
AbdelazizOmar
Bro How this code will Work if the Onther user dont have the Path file on his Pc
It won't, and why would you expect it to? You can't magically run software on a computer that isn't there. If you want to run a program then the program has to actually be there. It's that simple.
-
Re: How To Lunch exe program from vb project in any PC
Quote:
Originally Posted by
jmcilhinney
It won't, and why would you expect it to? You can't magically run software on a computer that isn't there. If you want to run a program then the program has to actually be there. It's that simple.
Yep i will Upload the Program Files with my app.exe Folder so from the program in just click the program open so Now The Above Code will Work ? if work How i can Use it ?
-
Re: How To Lunch exe program from vb project in any PC
Quote:
Originally Posted by
AbdelazizOmar
Hello Guys i want to make Project filled with exe files can any one use it in any pc iam using vb2010 Express
Any Solution?
Quote:
Originally Posted by
AbdelazizOmar
Look! i need to make program which has a collection for programs exe if the user click in a button the program Open in any pc
i try this code BUt it open in my pc only if i used in any pc Error Appear
HTML Code:
Process.Start("C:\path_to\myapp.exe")
Like that program when i click on the Run Beethink Setup Program Appear and the folder of program have the setup exe file
Attachment 133053
Quote:
Originally Posted by
AbdelazizOmar
Bro How this code will Work if the Onther user dont have the Path file on his Pc
I'm going to take all of these statements together, apply some assumptions, mix in a blender and see if I can come out with the more correct solution...
It sounds like you want to package multiple pre-existing apps into your app, then have your application extract them and run them when the user clicks a button. That's what installers are for. I don't recommend writing your own, because there are parts of the system it needs to write to (potentially) that Windows isn't going to let you have access to (but a properly registered installer would).
Also, a lot of viruses work this way... by packaging themselves inside another app... so it's possible that your app could get flagged as a potential threat.
-tg
-
Re: How To Lunch exe program from vb project in any PC
I think he means he has a program and there will be other exe files in the deployed folder that his app will want to be able to run, if so then Application.StartupPath is what he's looking for when calling any of those other exe files.
-
Re: How To Lunch exe program from vb project in any PC
Quote:
Originally Posted by
JuggaloBrotha
I think he means he has a program and there will be other exe files in the deployed folder that his app will want to be able to run, if so then Application.StartupPath is what he's looking for when calling any of those other exe files.
Yep JuggaloBrotha You Know my request
-
Re: How To Lunch exe program from vb project in any PC
Any Useful Answer? i Have A Program and i want to Fill it With a Programs Any User in any Pc Can Open The Program from My Program i have made it Like That Video !>>> https://youtu.be/e7TAX7JxefI
-
Re: How To Lunch exe program from vb project in any PC
Quote:
Originally Posted by
AbdelazizOmar
Any Useful Answer? i Have A Program and i want to Fill it With a Programs Any User in any Pc Can Open The Program from My Program i have made it Like That Video !>>>
https://youtu.be/e7TAX7JxefI
I thought we already answered this, you have the exe files in the same folder as your app's exe file (I'm assuming an installer will guarantee that), then when the user selects (or does whatever to run) one of the programs you combine the Application.StartupPath with the exe file and and pass it to a Process.Start() to run it.
You can even use Directory.GetFiles() with Application.StartupPath to get the list of files as needed too.
-
Re: How To Lunch exe program from vb project in any PC
Quote:
Originally Posted by
JuggaloBrotha
I thought we already answered this, you have the exe files in the same folder as your app's exe file (I'm assuming an installer will guarantee that), then when the user selects (or does whatever to run) one of the programs you combine the Application.StartupPath with the exe file and and pass it to a Process.Start() to run it.
You can even use Directory.GetFiles() with Application.StartupPath to get the list of files as needed too.
Bro iam Beginner! Can You Explain To me by Steps Or Photo ?
-
Re: How To Lunch exe program from vb project in any PC
Quote:
Originally Posted by
AbdelazizOmar
Bro iam Beginner! Can You Explain To me by Steps Or Photo ?
You're a beginner, not a vegetable. You've been told exactly what to do so now is where you make an effort to do it. Don't just assume that you can't and expect others to do for you. If you have an issue, then you can post what you've tried and we can tell you how to correct it.
-
Re: How To Lunch exe program from vb project in any PC
Quote:
Originally Posted by
jmcilhinney
You're a beginner, not a vegetable. You've been told exactly what to do so now is where you make an effort to do it. Don't just assume that you can't and expect others to do for you. If you have an issue, then you can post what you've tried and we can tell you how to correct it.
Bro How can i get Directory.GetFiles() with Application.StartupPath ?? Which code can i use which steps can i do ?
-
Re: How To Lunch exe program from vb project in any PC
Quote:
Originally Posted by
AbdelazizOmar
Bro How can i get Directory.GetFiles() with Application.StartupPath ?? Which code can i use which steps can i do ?
Directory.GetFiles Method (String) (System.IO)
Application.StartupPath Property (System.Windows.Forms)
If that's too advanced for you, I'd suggest learning up on vb.net and programming in general: VB.Net Tutorial
-
Re: How To Lunch exe program from vb project in any PC
Quote:
Originally Posted by
AbdelazizOmar
Bro How can i get Directory.GetFiles() with Application.StartupPath ?? Which code can i use which steps can i do ?
Bro, did you put any thought into it? What does Directory.GetFiles do? Have you made any effort to find out? It takes a folder path and returns an array of file paths for the files in that folder. What does Application.StartupPath do? Have you made any effort to find out? It returns a folder path. Can you put 2 and 2 together? If you sit there and expect the information to come to you then you should not be surprised when you get no information.
-
Re: How To Lunch exe program from vb project in any PC
Quote:
Originally Posted by
jmcilhinney
Bro, did you put any thought into it? What does Directory.GetFiles do? Have you made any effort to find out? It takes a folder path and returns an array of file paths for the files in that folder. What does Application.StartupPath do? Have you made any effort to find out? It returns a folder path. Can you put 2 and 2 together? If you sit there and expect the information to come to you then you should not be surprised when you get no information.
i DOn't know information! BUt i post thread here to get help how can i do it all told me Do that : Directory.GetFiles() with Application.StartupPath ??
But How? Are Directory.getfiles that i should upload the files to it or what? there any video or pdf website explain that ?
-
Re: How To Lunch exe program from vb project in any PC
Quote:
Originally Posted by
jmcilhinney
Bro, did you put any thought into it? What does Directory.GetFiles do? Have you made any effort to find out? It takes a folder path and returns an array of file paths for the files in that folder. What does Application.StartupPath do? Have you made any effort to find out? It returns a folder path. Can you put 2 and 2 together? If you sit there and expect the information to come to you then you should not be surprised when you get no information.
Quote:
Originally Posted by
AbdelazizOmar
i DOn't know information! BUt i post thread here to get help how can i do it all told me Do that : Directory.GetFiles() with Application.StartupPath ??
But How? Are Directory.getfiles that i should upload the files to it or what? there any video or pdf website explain that ?
Guys, I've already linked him to the documentation that explain exactly (even has code examples) for each of the things mentioned:
Quote:
Originally Posted by
JuggaloBrotha
It's up to him to show some effort now.
-
1 Attachment(s)
Re: How To Lunch exe program from vb project in any PC
Quote:
Originally Posted by
JuggaloBrotha
Guys, I've already linked him to the documentation that explain exactly (even has code examples) for each of the things mentioned:It's up to him to show some effort now.
Ok Bro i have Onther idea to make ....... i want the User slecet the file from button and the path file appear in text then he click in Open file the program OPen and button to save changes like that photo Which Codes can i Use Attachment 133393
For File path= ! ?
For Open File- ! ?
For Save Changes = !? when he open the program again he will find the program selected so when click in open the program open .
-
Re: How To Lunch exe program from vb project in any PC
Quote:
Originally Posted by
AbdelazizOmar
Ok Bro i have Onther idea to make ....... i want the User slecet the file from button and the path file appear in text then he click in Open file the program OPen and button to save changes like that photo Which Codes can i Use
Attachment 133393
For File path= ! ?
For Open File- ! ?
For Save Changes = !? when he open the program again he will find the program selected so when click in open the program open .
You can use an OpenFileDialog for getting the file (program) to run.
Then in the other button you can use Process.Start() to run it.
-
Re: How To Lunch exe program from vb project in any PC
Quote:
Originally Posted by
JuggaloBrotha
Bro now i have Code for Browisng file
Code:
Dim dialog As New OpenFileDialog()
If DialogResult.OK = dialog.ShowDialog Then
TextBox1.Text = dialog.FileName
End If
Now i need Code for Button2 ( OPen file path you Selected) which the file that user select from Button1 To Make Program Open...... Which Code can i use can you Direct and give me the code
-
Re: How To Lunch exe program from vb project in any PC
Process.Start(TextBox1.Text)
Process.Start(Application.StartupPath & "\MyApp.exe")
-
Re: How To Lunch exe program from vb project in any PC
Quote:
Originally Posted by
AbdelazizOmar
Bro now i have Code for Browisng file
Code:
Dim dialog As New OpenFileDialog()
If DialogResult.OK = dialog.ShowDialog Then
TextBox1.Text = dialog.FileName
End If
Now i need Code for Button2 ( OPen file path you Selected) which the file that user select from Button1 To Make Program Open...... Which Code can i use can you Direct and give me the code
*le sigh*
vb.net Code:
Imports System.IO
Public Class Form1
Private m_Process As Process
Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
TextBox1.ReadOnly = True
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim ProgramFileName As String = Path.GetFileName(Application.ExecutablePath).ToLower
Using ofd As New OpenFileDialog With {.InitialDirectory = Application.StartupPath, .Title = "Select a program to run", .DefaultExt = "exe", .Filter = "Exe Files|*.exe", .AddExtension = True}
If ofd.ShowDialog(Me) <> DialogResult.Cancel AndAlso Not ofd.FileName.ToLower.EndsWith(ProgramFileName) Then TextBox1.Text = ofd.FileName
End Using
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
m_Process = Process.Start(TextBox1.Text)
End Sub
End Class
That's only for using an OpenFileDialog, like was discussed before, you can load those program's file names into something like a ComboBox that way the available options are given to them and you simply grab the file name selected and append the Applicatio.StartupPath and run it.