Re: CStdioFile::Open gives error "No error occurred"



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:
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 ) )
{}
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: Cannot delete directory
    ... "Glenn" wrote in message ... > in a command window. ... >>window is a "normal" window. ... >>be a valid 8.3 filename - even if it has somehow been ...
    (microsoft.public.win2000.file_system)
  • Re: Strange problem, after changing computer
    ... Look in the registry under the file command line for the wzzip app. ... When I open cmd window and type this: ... :> when you open it with Explorer. ... It should still get the Long filename ...
    (microsoft.public.vb.general.discussion)
  • Re: Great SWT Program
    ... mostly solve the blind-typing problem that I definitely recall emacs ... Except of course that you need to know some arcane command language ... Hitting tab should insert a tab ... one-line "window" in which the rest of what I type appears, ...
    (comp.lang.java.programmer)
  • Re: Printer Control and Print/Preview Problems
    ... to be appended to the report print stream. ... or "Print" with the DoCmd.OpenReport command, ... still open preview window. ... > following that with an OpenReport using acNormal. ...
    (microsoft.public.access.reports)
  • Re: Dim RetVal
    ... "Jay Freedman" wrote in message ... The reason is that without the quotes, the command processor sees the ... In the command window, first type ... This *should* have exactly the same effect as the macro. ...
    (microsoft.public.word.vba.beginners)