ShellExecute quit working

  • Thread starter Thread starter David
  • Start date Start date
D

David

We have an mfc application in which we use ShellExecute
to launch the browser with an initial web site.
{ShellExecute(
NULL, "open", "http://www.SomeWebSite.com", NULL, NULL,
SW_SHOWNORMAL ) } This always worked without problems
until...

We have modified the application so that it now contains
some managed C++ and C# code (in dll's). The call to
ShellExecute is in an unmanaged C++ dll. When trying
to 'open' a web page, the ShellExecute returns an access
denied message. Drilling down a little showed the actual
error to be a system error 14000 which says "The
requested section was not present in the activation
context."

Other postings indicated that, for a C# application, the
attribute [STAThread] needed to be applied to the main
routine to correct this problem.

Does anyone have any ideas as to why this stopped working
and what is needed to get it going again for a C++ app
with some managed code?

TIA,

David
 
Here is why...i think

Hi,
The code should look like this

...{
ShellExecute(hwnd,"open",<file path>,NULL,NULL,SW_SHOWNORMAL);
}

Make sure that the handle "hwnd" is "defined". i.e. HWND hwnd;

Hope this helps
 
Back
Top