2

I'm trying to open some html file with the default browser from my code.

I use the following code:

ShellExecute(NULL, "open", "HELP\index.html",
            NULL, NULL, SW_SHOWNORMAL);

And include header "Windows.h". But ShellExecuter:identifier not found error comes up and compilation fails.

I use Microsoft Visual Studio 2010. How can I make ShellExecute work, or more to the point, how can I open a html file from my code?

Emre Turkoz
  • 848
  • 1
  • 22
  • 33

2 Answers2

5

to use ShellExecute, you should include Shellapi.h and link with Shell32.lib library

elhadi dp ıpɐɥןǝ
  • 4,397
  • 1
  • 28
  • 31
0

I had a similar problem:

On WinXP

ShellExecute( NULL, NULL, "HELP\index.html", NULL, NULL, NULL );

and as well

ShellExecute( NULL, "call", "HELP\index.html", NULL, NULL, NULL );

both work fine.

Whereas on Window-7 (starter) only

ShellExecute( NULL, "open", "HELP\index.html", NULL, NULL, NULL );

is possible.

XP seems not to know "open" and Win-7 not to know "call". I used the MINGW for all the building.

Mickäel A.
  • 8,434
  • 4
  • 48
  • 67
Berndi
  • 21
  • 4