Hi,
I am writing dialog based MFC application and one of the tasks is to control Notepad...
I have found some code to open Notepad and specific text file..
All works fine, but I have two problems...
1. I don’t know how to close text file (there no need to modify it) and quit Notepad...
2. When I send not existing file name I get an error saying that file is not found and asking me if I want to create a new one.... What I want is my own text box and no Notepad shown.
Below is the code I am using....
Please help me to get around....
Thanks
Val....
.........
HINSTANCE hInst = ShellExecute(0,
"open", // Operation to perform
"H:\\WINDOWS\\system32\\notepad.exe", // Application name
"D:\\Input\\Instructio.txt", // Document location
0, // Default directory
1); // SW_SHOW
if(reinterpret_cast<int>(hInst) <= 32)

{
// Could not start application
switch(reinterpret_cast<int>(hInst))

{
case 0:
// The operating system is out of memory or resources.
break;

case ERROR_FILE_NOT_FOUND:
// The specified file was not found.
{
MessageBox(" The specified file was not found.");
}
break;

case ERROR_PATH_NOT_FOUND:
// The specified path was not found.
{
MessageBox(" The specified path was not found.");
}
break;

case ERROR_BAD_FORMAT:
// The .exe file is invalid (non-Microsoft Win32 .exe or error in .exe image).
break;

case SE_ERR_ACCESSDENIED:
// The operating system denied access to the specified file.
break;

case SE_ERR_ASSOCINCOMPLETE:
// The file name association is incomplete or invalid.
break;

case SE_ERR_DDEBUSY:
// The Dynamic Data Exchange (DDE) transaction could not be completed because
// other DDE transactions were being processed.
break;

case SE_ERR_DDEFAIL:
// The DDE transaction failed.
break;

case SE_ERR_DDETIMEOUT:
// The DDE transaction could not be completed because the request timed out.
break;

case SE_ERR_DLLNOTFOUND:
// The specified dynamic-link library (DLL) was not found.
break;
// case SE_ERR_FNF:
// The specified file was not found.
// break;

case SE_ERR_NOASSOC:
// There is no application associated with the given file name extension.
// This error will also be returned if you attempt to print a file that is
// not printable.
break;

case SE_ERR_OOM:
// There was not enough memory to complete the operation.
break;

// case SE_ERR_PNF:
// // The specified path was not found.
// break;

case SE_ERR_SHARE:
// A sharing violation occurred.
break;


}
} }