hi, i have a button, and when clicked, i would like it to open an html file, i searched MSDN and i looked through my book, i can't find anything to do this. can someone please help? ok thank you
hi, i have a button, and when clicked, i would like it to open an html file, i searched MSDN and i looked through my book, i can't find anything to do this. can someone please help? ok thank you
Do you want to open it with the default browser? If so, check out ShellExecute. Simple example here
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
well, i basically want to click a button(this is all MFC stuff i did) and then it opens up IE and my html page is there. With all the documentation i need.
that link you provided seemed somewhat helpful but when i tried to use it, it wouldnt open up my html document, i think it just opens up .exe's.
anyone else might know? i checked all the documentation i had, and all it says is how to open up executables, when i tried to use my html file, nothing happened, i used the WinExec function and that didnt work..
If you use ShellExecute and pass the URL as the file name, then it should open it in the default browser.
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
Right. You'll have to specify the browser executable (iexplore.exe for Internet Explorer) and the path to your HTML document as the parameter field. The operation to perform should remain "open," as shown in the example.Originally posted by Ripper1
that link you provided seemed somewhat helpful but when i tried to use it, it wouldnt open up my html document, i think it just opens up .exe's.
"Optimal decisions, once made, do not need to be changed." - Robert Sedgewick, Algorithms in C
No, it opens up files with whatever the default program for that file type is - in the case of url's it will be your browser. There should be no need to specify the program name for this use.Originally posted by Ripper1
that link you provided seemed somewhat helpful but when i tried to use it, it wouldnt open up my html document, i think it just opens up .exe's.
Replace 'szPath' in the FAQ example with your url. Your default browser should be launched with that webpage open (provided you have an active internet connection otherwise your browser should report an error). If that doesn't work, replace the SW_SHOW with SW_SHOWDEFAULT as the last parameter.
In either case, read up on ShellExecute.
If you still have problems - and you have remembered to link with the correct library (shell32.lib with msvc,bcc5.5; libshell32.a with mingw) - then post how you are using it.
BTW, WinExec is obsolete.
there is also another easy way to do it:
system("explorer.exe http://website.goes.here.com");
and that launches up the explorer and automatically goes to that site (can also be used for browsing)