Quantcast

Maximum PC

It is currently Wed Sep 17, 2014 7:37 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: VB 6.0 Launch A Program
PostPosted: Thu Nov 18, 2004 4:16 pm 
Team Member [Top 500]*
Team Member [Top 500]*
User avatar

Joined: Thu Jun 24, 2004 2:22 pm
Posts: 8720
Location: Cleveland, Ohio
First, I am not a programmer. If I had to earn a living with my programming skills, I would starve in a few hours.

I dabble in and mess with VB 6.0 and also have Visual Studio .NET.

I built a simple little login form for the hell of it to learn a little. I played with adding a few twist and case statements. All of that works just fine.

Now what I want to happen, is when a command button is clicked, I want a particular program to open and for the form to close. I tried a Shell and things don't quite work right.

Private Sub Command1_Click()

Shell "F:\Program Files\Jasc Software Inc\Paint Shop Pro 7\psp.exe"

End Sub

What would be a good way to go about this? Just a simple command line to open a program from a command button on my form?

Thanks Guys
Ron


Top
  Profile  
 
 Post subject:
PostPosted: Thu Nov 18, 2004 8:37 pm 
Team Member Top 100
Team Member Top 100

Joined: Fri Sep 17, 2004 5:35 pm
Posts: 1176
Try CreateProcess() or ShellExecute().

For launching a process, CreateProcess() is preferred.


Top
  Profile  
 
 Post subject:
PostPosted: Fri Nov 19, 2004 10:32 am 
Team Member [Top 500]*
Team Member [Top 500]*
User avatar

Joined: Thu Jun 24, 2004 2:22 pm
Posts: 8720
Location: Cleveland, Ohio
I got it to work good! I used Shell much like before, however, I was leaving Focus out which is why it would not open the way I wanted it to. Also, the PSP program I was using as an example has a bad file, I really need to fix that, thus I used PSP 8 as an example. Here is what works:

Private Sub Command1_Click()
Dim t As Double
t = Shell("F:\Program Files\Jasc Software Inc\Paint Shop Pro 8\Paint Shop Pro.exe", vbNormalFocus)
End Sub

I intend to mess with CreateProcess next. Thanks again.

Ron


Top
  Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group