 |
|
|
|
| Author |
Message |
mrabie
Joined: 07 Jan 2008 Posts: 11
|
Posted: Mon Feb 04, 2008 8:37 pm Post subject: Opening files with associated applications? |
|
|
Hi all,
I am writing a file explorer application for PocketPC, i use
Systems.Diagnostics Process to start application, but is there a way
to when i click on an image/doc/xls it automatically opens it with the
associated app (image viewer/pocket work/pocket excel,etc)?
I try to pass the file name as the parameter to the Process.Start but
it returns an error
Thanks for your help
Archived from group: microsoft>public>dotnet>framework>compactframework |
|
| Back to top |
|
 |
Paul G. Tobey [eMVP]
Joined: 08 Aug 2007 Posts: 185
|
Posted: Mon Feb 04, 2008 9:43 pm Post subject: Re: Opening files with associated applications? |
|
|
If nothing else, you could P/Invoke ShellExecuteEx(). That's what the
Explorer shell does (of course, it's native code, so there may be some
wrapper in managed code that I'm not thinking of), when you tap on a
non-executable file.
Paul T.
"mrabie" wrote in message @v67g2000hse.googlegroups.com...
> Hi all,
>
> I am writing a file explorer application for PocketPC, i use
> Systems.Diagnostics Process to start application, but is there a way
> to when i click on an image/doc/xls it automatically opens it with the
> associated app (image viewer/pocket work/pocket excel,etc)?
>
> I try to pass the file name as the parameter to the Process.Start but
> it returns an error
>
> Thanks for your help |
|
| Back to top |
|
 |
Arun
Joined: 08 Aug 2007 Posts: 4
|
Posted: Mon Feb 04, 2008 9:04 pm Post subject: Re: Opening files with associated applications? |
|
|
You can very well do it using ProcessStartInfo class. Below is a
snippet
Process myProcess = new Process();
myProcess.StartInfo.FileName = myDocumentsPath + "\\MyFile.doc";
myProcess.Start();
my.StartInfo.UseShellExecute is another property by default will be
true will start the document in the associated editor.
if it is set to false, the process is created directly from the
executable file.
Hope this helps,
Cheers,
Arun
On Feb 4, 3:37 pm, mrabie wrote:
> Hi all,
>
> I am writing a file explorer application for PocketPC, i use
> Systems.Diagnostics Process to start application, but is there a way
> to when i click on an image/doc/xls it automatically opens it with the
> associated app (image viewer/pocket work/pocket excel,etc)?
>
> I try to pass the file name as the parameter to the Process.Start but
> it returns an error
>
> Thanks for your help |
|
| Back to top |
|
 |
user
Joined: 08 Aug 2007 Posts: 286
|
Posted: Mon Feb 04, 2008 11:02 pm Post subject: Re: Opening files with associated applications? |
|
|
Set the Process's StartInfo.UseShellExecute property to true.
--
Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com
"mrabie" wrote in message @v67g2000hse.googlegroups.com...
> Hi all,
>
> I am writing a file explorer application for PocketPC, i use
> Systems.Diagnostics Process to start application, but is there a way
> to when i click on an image/doc/xls it automatically opens it with the
> associated app (image viewer/pocket work/pocket excel,etc)?
>
> I try to pass the file name as the parameter to the Process.Start but
> it returns an error
>
> Thanks for your help |
|
| Back to top |
|
 |
Christopher Fairbairn
Joined: 08 Aug 2007 Posts: 19
|
Posted: Tue Feb 05, 2008 6:03 pm Post subject: Re: Opening files with associated applications? |
|
|
Hi,
"mrabie" wrote in message @v67g2000hse.googlegroups.com...
> I am writing a file explorer application for PocketPC, i use
> Systems.Diagnostics Process to start application, but is there a way
> to when i click on an image/doc/xls it automatically opens it with the
> associated app (image viewer/pocket work/pocket excel,etc)?
Try using the start info property:
Process p = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo(@"\path\to\file.doc", "");
p.StartInfo = startInfo;
p.Start();
This will internally use the native ShellExecuteEx API mentioned by Paul in
another reply to your thread. Hence the file association registry enteries
will be utilised to find the application associated with these files.
Hope this helps,
Christopher Fairbairn
|
|
| Back to top |
|
 |
|
|
| Related Topics: | Problem opening several modal forms Hello My application opens several modal forms (the modal Form1 opens the modal Form2 that opens the modal Form3 and so on), but, the third and the successives modal forms.... are not modal!!! Seems that there's a maximum number of modal forms, is it poss
SP1 CAB files Does SP1 replace the CAB file in "Program Visual Studio .NET CE" I updated my dev machine but the CAB files are the same.
SP1 CAB files for ARMv4T I see the SP1 release has cabfiles for armv4 and armv4i, but none for armv4t. Is this a deliberate choice ? Stephane
Creating Cabinet Files I seem to be hitting a problem when I try to create a cabinet file for an Application that deploys and runs normally. Unfortunately the error I am getting seems a little obscure: "C:\Program Visual Studio
Help for transfering files between WinCE device and PC ! Hi group ! I've a quite big problem : I've an application on a WinCE device and it needs to connect automatically (after clicking on a button when the device is on the docking station) to a PC and to send and receive some files. The target PC is not direc |
|
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 vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|