Re: CStdioFile::Open gives error "No error occurred"
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Wed, 27 Dec 2006 18:59:45 -0500
I looked at the article, and I don't see anything related to what you are doing.
I have no idea what the original intent of the program was, but if the filename is
provided by DDE, which it clearly is in this case, then trying to use the command line as
something other than what it is intended for won't work, and the fact that it fails should
come as no surprise.
You say you replaced the AfxMessageBox; why didn't you leave it in so you could see what
is appearing? Since you have absolutely no idea what is on the command line (if you had,
you would have reported it), you have no idea what is really going on. When I tried it
with an app I built just to see what was going on, I got a line that simply said "/dde",
and then at some later time the shell popped up a window (and using Spy++,you can prove it
is the explorer that pops this up; just ask for the process ID of the window using Spy++,
then convert it to decimal and look at what process is reported to have that ID using Task
Manager; in my case it was process ID 7004)
You have also not explained why you are trying to open a file in InitInstance, since there
is nothing there that should know or care about the input file. What, exactly, is the
purpose of opening the file at this stage of execution: there's no real application yet!
There's no frame, no windows, and no way to do anything with a document or view.
So why are you doing it? And why did you think it a useful exercise to eliminate the line
that told you what the filename was?
joe
On Wed, 27 Dec 2006 12:46:01 -0800, Rui Oliveira <RuiOliveira@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
I have used the following sample:Joseph M. Newcomer [MVP]
http://www.codeproject.com/shell/cgfiletype.asp
I have changed line
AfxMessageBox(m_lpCmdLine);
with the
CStdioFile lcl_file;
CFileException e;
if( !lcl_file.Open(m_lpCmdLine, CFile::modeRead | CFile::shareDenyNone
, &e ) )
{}
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- References:
- Re: CStdioFile::Open gives error "No error occurred"
- From: Joseph M . Newcomer
- Re: CStdioFile::Open gives error "No error occurred"
- From: Rui Oliveira
- Re: CStdioFile::Open gives error "No error occurred"
- From: Joseph M . Newcomer
- Re: CStdioFile::Open gives error "No error occurred"
- Prev by Date: Re: Future for VC++ Programmers
- Next by Date: Re: Future for VC++ Programmers
- Previous by thread: Re: CStdioFile::Open gives error "No error occurred"
- Next by thread: Building Tree Control
- Index(es):
Relevant Pages
|