I've written a program for my assignment and well it working fine but what I can't get my head around is how to call a CHM or a PDF file and display it and return back to the program.
I use the below function to display a text from a text file but it doesn't look professional I use a case operator to make menu which will call the below function I could use that to open the chm or PDF with out leaving the main window like in any other GUL based program hope you guys can help me.
//This function opens a text file and display the content as the help document
void hlpDoc(){
system("CLS");
string txtHlp;
ifstream hlpFile;
hlpFile.open("hlpDoc.txt");
if(hlpFile.is_open()){
while(hlpFile.good()){
getline(hlpFile, txtHlp);
cout<<txtHlp<<endl;
}
}
hlpFile.close();
entLine();
pause();
}
And this site helped me a lot during my studies thank you guys for helping me this place is a haven for noobs like us.
Kooth Thx, No I don;t want to display the file inside the same screen as the program what I want to do is that when I enter the number specified for help the chm or PDF opens up in it own supported program.
I've no idea to integrate the PDF or the CHM program viewers in to the CLI interface (That takes too much time and Time I don't have).
Also I was hoping that I could do it with out System() 'cos System() is evil
Also I was hoping that I could do it with out System() 'cos System() is evil
Yes, system() is evil. However, there is no good way to call open the CHM or PDF files from your program without fiddling around with the registry (on windows, at any rate) to find what program is used to open those types of files, and then finding the location of that program so that you can run it with the appropriate API call. You have to use evil things sometimes (or do something else instead).
You will probably need to do a bit more work to make sure you are in the right folder. For example, on Windows, get your executable path with GetModuleFileName(NULL) and then you can use the following command to open the file:
Will do thank you well I kinda don't have the MSDN documentation mostly used this forum and the help in here I will play around with the code you just put up.
I've been researching and found that there's a header called HtmlHelp.h can I use this in a CLI application like mine or is this for GUI based programs.