you can do it couple of ways.
First using File select dialog, select the name of the file selected into a
string.
1. use pinvoke and call the api shellexecute with the bmp file selected.
here is the unmanaged example.
http://support.microsoft.com/default.aspx/kb/170918
2. launch mspaint.exe with process class in .NET
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "mspaint.exe";
// set windows dir
proc.StartInfo.WorkingDirectory = .....
// pass the bmp file name with full path
proc.StartInfo.Arguments =
proc.Start();
-VR
Thank you, I still want to know whether this is way to call the default
assoicated program to open it.
E.g: If bmp is selected, maybe mspaint will be called. If .doc is selected,
microsoft word will be launched. Thx
"VR Ravinuthala" <VRRavinuthala@discussions.microsoft.com> дÈëÏûÏ¢ÐÂÎÅ:B45844D2-C7A7-4786-9DC7-A2813FD3EBA1@microsoft.com...
> you can do it couple of ways.
>
[quoted text clipped - 27 lines]
>>
>> zlf
Jeff Gaines - 02 Jun 2007 17:16 GMT
>Thank you, I still want to know whether this is way to call the default
>assoicated program to open it.
>E.g: If bmp is selected, maybe mspaint will be called. If .doc is
>selected, microsoft word will be launched. Thx
If you call Process.Start using just a document name the default
application (assuming there is one) will open. I use:
public static bool StartProcess(string strCommand, string strWD, out
string strErr)
{
bool blnOK = false;
ProcessStartInfo psi = new ProcessStartInfo();
strErr = "";
// Initialize the ProcessStartInfo structure
psi.FileName = strCommand;
psi.WorkingDirectory = strWD;
psi.RedirectStandardInput = false;
psi.RedirectStandardOutput = false;
psi.UseShellExecute = true;
Process proc = new Process();
try
{
Process.Start(psi);
blnOK = true;
}
catch (Exception e)
{
strErr = e.Message;
blnOK = false;
}
return blnOK;
}

Signature
Jeff Gaines
zlf - 02 Jun 2007 17:28 GMT
It works! Thank you :)
"Jeff Gaines" <whitedragon@newsgroups.nospam>
??????:xn0f6zc437m9gp3005@msnews.microsoft.com...
> On 02/06/2007 in message <O9SjclSpHHA.1220@TK2MSFTNGP03.phx.gbl> zlf
> wrote:
[quoted text clipped - 34 lines]
> return blnOK;
> }