Wrox Programmer Forums
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 27th, 2003, 07:59 PM
kaz kaz is offline
Authorized User
 
Join Date: Dec 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default ShellExecute problem

I have still had the same problem, "the system can't find the file specified." If you have some ideas to fix it, please let me know. Here is the code. The string myDocumentsPath is "C:\MyProject\Documents\" and the string fileName is "myword.doc".

public void OpenDoc(string myDocumentsPath,
string fileName)
{
try
{
string tempFileName = myDocumentsPath + fileName;
Process.Start(tempFileName);
}
catch (Win32Exception e)
{
if(e.NativeErrorCode == ERROR_FILE_NOT_FOUND)
{
Console.WriteLine(e.Message + ". Check the path.");
}
else if (e.NativeErrorCode == ERROR_ACCESS_DENIED)
{
Console.WriteLine(e.Message + ". You do not have permission to open this file.");
}
}







Similar Threads
Thread Thread Starter Forum Replies Last Post
shellexecute and Microsoft Outlook jake Beginning VB 6 4 September 6th, 2005 05:12 AM
ShellExecute Problem soccers_guy10 Pro VB.NET 2002/2003 3 April 25th, 2005 02:59 AM
passing/getting arguments from ShellExecute TazMania23 Visual C++ 0 May 21st, 2004 12:14 PM
DLL vs ShellExecute() eamonn_ryan Visual C++ 0 September 26th, 2003 12:27 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.