• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 341
  • Last Modified:

File opening problem

I've  got the following problem:

if I want to programmatically open for example a .BMP file with ITS applicaion (MS Paint) I use the command:
system ("picture.BMP");

Though I get a black DOS-window (cmd.exe) too, it works well.
But when I want to open a .HTM file with Internet Explorer it doesn't work- I only get the black window and Internet Explorer doesn't run. (.HTM files are attatched to IE on my computer)
I could use
WinExec ("C:\\Programme\\Internet Explorer\\IEXPLORE.EXE website.htm", SW_RESTORE);
but the path to the Internet Explorer isn't the same on all computers...
1 Solution

ShellExecute(NULL,"open", "website.htm", NULL, NULL, SW_SHOW);

I believe you could just do...

WinExec ("IEXPLORE.EXE website.htm", SW_RESTORE);

king of like typeing iexplore.exe from the run menu
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

MegaEnforcerBoyAuthor Commented:
thanks a lot
jkr will get the points because he was the first one who posted the right answer;
but could you tell me first, why only ShellExecute works, though there are many other functions, such as _swanl, _execl, WinExec, system and maybe some other, which partially even cause a syntax error and some of them don't work correctly? Actually they must solve the same problem, so what's the difference between them?
Quote from MSDN:
If the executable or path name has a space in it, there is a risk that a different executable could be run because of the way the function parses spaces.

Also as I think WinExec accepts parameters, as there is an example of such use:
WinExec("\"C:\\Program Files\\MyApp.exe\" -L -S", ...)
Note that WinExec exists for compatibility.
MegaEnforcerBoyAuthor Commented:
you didn't answer my question.. well, maybe the answer is not that easy. but i accept your answer
>>you didn't answer my question..

Um, what else then? You wanted to open a HTML page with IE, and that's what it does. Nothing else.
MegaEnforcerBoyAuthor Commented:
that's all right, I mean my second question- right after gillgates' comment- what's the difference between all these numerous functions/why some of them don't work.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now