Discussion:
ShellExecute and SE_ERR_NOASSOC error
(too old to reply)
Konrad
2007-02-26 10:59:00 UTC
Permalink
Hello everybody,

I've been using ShellExecute for many years, and now users started to
report it doesn't work - i.e. opening documents/programs from one of my
application doesn't work for them.

What I'm doing is:
int
nRet=(int)ShellExecute(NULL,NULL,sFullPathToProgram,_T(""),NULL,SW_SHOWNORMAL);
And the return code is 31 (SE_ERR_NOASSOC - the file isn't associated
with any program) - this happens to documents (like .txt) as well as
applications - but in most situations this are actually links to
documents/programs.

I just have no idea what to do about - googling doesn't help.

environment: vc 7.0, WinXP pro

p.s. some of users mention that this began with the installation of IE
7.0 but some of them say they still have IE 6.0, so I'm not sure if this
may be the isuue.
David Lowndes
2007-02-26 12:41:05 UTC
Permalink
Post by Konrad
I've been using ShellExecute for many years, and now users started to
report it doesn't work - i.e. opening documents/programs from one of my
application doesn't work for them.
int
nRet=(int)ShellExecute(NULL,NULL,sFullPathToProgram,_T(""),NULL,SW_SHOWNORMAL);
And the return code is 31 (SE_ERR_NOASSOC - the file isn't associated
with any program) - this happens to documents (like .txt) as well as
applications - but in most situations this are actually links to
documents/programs.
Can these users use the Run dialog to open the same files?

What if you change your code to use the "open" verb rather than the
default?

You can try experimenting with my ShellExec test program
(http://www.jddesign.f2s.com/freeware_programs.htm#ShellExec) on the
problem systems to see if that sheds any light on the situation.

Dave
Konrad
2007-02-26 13:12:51 UTC
Permalink
Post by David Lowndes
Post by Konrad
I've been using ShellExecute for many years, and now users started to
report it doesn't work - i.e. opening documents/programs from one of my
application doesn't work for them.
int
nRet=(int)ShellExecute(NULL,NULL,sFullPathToProgram,_T(""),NULL,SW_SHOWNORMAL);
And the return code is 31 (SE_ERR_NOASSOC - the file isn't associated
with any program) - this happens to documents (like .txt) as well as
applications - but in most situations this are actually links to
documents/programs.
Can these users use the Run dialog to open the same files?
What if you change your code to use the "open" verb rather than the
default?
You can try experimenting with my ShellExec test program
(http://www.jddesign.f2s.com/freeware_programs.htm#ShellExec) on the
problem systems to see if that sheds any light on the situation.
Dave
Thanks for the answer.
No - those users have no problems with the Run dialog.
About using "open" as a verb - OK, I'll try it but I don't think it's a
good idea, since in some cases the default operation is different, and
I'd like my application to behave just like double-clicking in Win
explorer - that's what users expect. E.g. Winamp - lot's of Users have
"Enqueue in Winamp" as the default action for mp3 files - now if my app
would use "Open" as the verb - they would loose they list of music files
- because "Open" makes Winamp to remove all the files from 'playlist
editor' and open this only one file.
I'm pretty sure there are many other examples, which make using "open"
nonstandard and surprising :( I really need the default action.
Any other ideas?
David Lowndes
2007-02-26 14:54:00 UTC
Permalink
Post by Konrad
Any other ideas?
Have you tried the test app I mentioned? Maybe ShellExecuteEx will do
something different?

Dave
Konrad
2007-02-26 15:56:15 UTC
Permalink
Post by David Lowndes
Post by Konrad
Any other ideas?
Have you tried the test app I mentioned? Maybe ShellExecuteEx will do
something different?
Dave
I have no access to those computers causing problems - but I've just
implemented a similiar solution to my application - that is - when it
comes to execute an application a dialog with a bunch of options will
appear (ShellExecuteEx is also available as an option).
I am now waiting for a report from users.
Konrad
2007-02-26 18:39:40 UTC
Permalink
Post by Konrad
Post by David Lowndes
Post by Konrad
Any other ideas?
Have you tried the test app I mentioned? Maybe ShellExecuteEx will do
something different?
Dave
I have no access to those computers causing problems - but I've just
implemented a similiar solution to my application - that is - when it
comes to execute an application a dialog with a bunch of options will
appear (ShellExecuteEx is also available as an option).
I am now waiting for a report from users.
First report shows that using ShellExecuteEx solves the problem (also
first resolving the .lnk file and then executing with ShellExecute does).
But I would be much more happy if I understood why is this so.

Additionally - it looks like IE 7.0 has nothing to do with it, but
rather some update published after it.
Konrad
2007-02-26 19:06:25 UTC
Permalink
Post by Konrad
First report shows that using ShellExecuteEx solves the problem (also
first resolving the .lnk file and then executing with ShellExecute does).
But I would be much more happy if I understood why is this so.
Additionally - it looks like IE 7.0 has nothing to do with it, but
rather some update published after it.
Oh, and using "open" as a verb didn't work either.

Loading...