ShellExecute problem in XP

ShellExecute problem in XP

Post by Elli » Sat, 14 Jun 2003 02:15:52



I have seen many messages in this thread and others complaining about
ShellExecute problems in XP.
I am trying to open a url from a C++ program using the default
browser.
My command is:
HINSTANCE hi =
                ShellExecute(
                        NULL,
                        "open",
                        "http://www.microsoft.com",
                        NULL,
                        NULL,
                        SW_SHOWNORMAL);

I compiled the executable in Visual.NET C++ on an XP machine.
When I run the executable on a Windows 2000 box, it pops up the
website just fine.
When I run it on XP, it does nothing for a while and then returns an
error code 29.

This is listed in ShellAPI.h as:   SE_ERR_DDEFAIL

Anyone know anything more useful about this?

Elliot Katz

 
 
 

ShellExecute problem in XP

Post by David Lownde » Sat, 14 Jun 2003 04:29:12


Elliot,

I don't seem to have such a problem. Which browser are you using as
your default?

Try some different options using the ShellExec test program on
(www.jddesign.co.uk). From the error message you received, you might
need to use ShellExecuteEx (though I don't know why as I don't need
to).

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq

 
 
 

ShellExecute problem in XP

Post by Bob Moor » Sat, 14 Jun 2003 22:24:54



Quote:>I am trying to open a url from a C++ program using the default
>browser.

What happens if you just double-click a html file ? I'm assuming that
the URL you provide actually resolves to an HTML or HTM file, so....

Go to any (Windows) explorer window
select Tools ~ Folder Options ~ File Types
select HTML file (or HTM)
press Advanced
select Open
press edit

What do you see as the setup ? I get the following :

Application used to perform action : <full path to exe>
Use DDE : checked
DDE Message :  "file://%1",,-1,0,,,,,
Application :  IExplore
DDE application not running: blank
Topic :    WWW_OpenURL

This is on Windows 2000, BTW. On XP systems I see this (slight)
difference :

DDE Message :  "%1",,-1,0,,,,

Why windows 2000 chooses to use an explicit  file qualifier I don't
know.