|
-
Dec 26th, 2003, 12:15 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] ShellExecute
How can I open a file with it's default program in a similar way to how I would use ShellExecute in VB6?
Thanks
Last edited by TomGibbons; Dec 26th, 2003 at 01:44 PM.
-
Dec 26th, 2003, 12:58 PM
#2
Hyperactive Member
You`ll need to call a new process:
Code:
Process showWordDoc = new Process();
showWordDoc.StartInfo.FileName = @"c:\myPath\myDoc.doc";
//showWordDoc.StartInfo.Arguments= ""; here you can put startup arguments
showWordDoc.StartInfo.UseShellExecute = true;
showWordDoc.Start();
showWordDoc.WaitForExit();
showWordDoc.Close();
I think you will need to include "using System.Diagnostics;" in order to work.
BTW: there are a lot more otions than the ones I posted, just look into them, all easy to understand.
HTH, Stephan
Keep Smiling - even if its hard 
Frankie Says Relax, wossname Says Yeah!
wossname:--Currently I'm wearing a gimp suit and a parachute.
C# - Base64 Blog
-
Dec 26th, 2003, 01:25 PM
#3
Sgt-Peppa, that is too much crap. He doesn't need all that just to execute a file
Process.Start("My.html")
done
-
Dec 26th, 2003, 01:33 PM
#4
Hyperactive Member
Sgt-Peppa, that is too much crap. He doesn't need all that just to execute a file
WOW was not aware of that, it works !
I never opend up a file,.. just called a lot of processes and needed to pass arguments.
So i thought thats the way to do it, you proved me wrong, and I learned, thanks
Stephan
Keep Smiling - even if its hard 
Frankie Says Relax, wossname Says Yeah!
wossname:--Currently I'm wearing a gimp suit and a parachute.
C# - Base64 Blog
-
Dec 26th, 2003, 01:37 PM
#5
Thread Starter
Frenzied Member
Originally posted by kasracer
Sgt-Peppa, that is too much crap. He doesn't need all that just to execute a file
Process.Start("My.html")
done
I get "The type or namespace name 'Process' could not be found (are you missing a using directive or an assembly reference?)"
Do I need a "using..."?
-
Dec 26th, 2003, 01:42 PM
#6
Hyperactive Member
Originally posted by Sgt-Peppa
I think you will need to include "using System.Diagnostics;" in order to work.
HTH, Stephan
Keep Smiling - even if its hard 
Frankie Says Relax, wossname Says Yeah!
wossname:--Currently I'm wearing a gimp suit and a parachute.
C# - Base64 Blog
-
Dec 26th, 2003, 01:44 PM
#7
Thread Starter
Frenzied Member
Ahh I thought that was just for your example. Thank you both
-
Dec 26th, 2003, 01:59 PM
#8
Originally posted by Sgt-Peppa
WOW was not aware of that, it works !
I never opend up a file,.. just called a lot of processes and needed to pass arguments.
So i thought thats the way to do it, you proved me wrong, and I learned, thanks
Stephan
lol no problem.
I think the full path, so you don't have to include System.Diagnostics is like
System.Diagnostics.Process.Start("OMG.vb")
-
Jan 17th, 2004, 02:02 AM
#9
Lively Member
was that sarcasm or truth?
DannyJoumaa
Advanced VB6 Programmer
Intermediate-Advanced VB .NET Programmer
Intermediate C# Programmer
Intermediate Win32 Developer
Beginner Mac OS X Developer
Contact: [email protected]
Favorite Sayings:
"Every time you open your mouth, you prove your an idiot."
"God is a programmer. Satan is a bug. Life is debugging."
-
Jan 17th, 2004, 02:24 AM
#10
Originally posted by Danny J
was that sarcasm or truth?
uh?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|