This is my give back to this awesome forum with your help I managed to create a function which will open a help file from the current directory the exe is in. If any person want to use it go ahead but if you modify it please share it here so others can learn as well.
includes you need to define when you use this
1 2 3
#include <Pathcch.h>
#include <Shlwapi.h>
And before you compile this code you need to add the
shlwapi.lib
to your linker other wise you'll get this error
error LNK2001: unresolved external symbol __imp__PathRemoveFileSpecA@4
To add the
shlwapi.lib
you need to right click on the project name -> Properties -> Linker -> Input -> Additional Dependencies drop it down click edit then copy paste the .lib name then press ok.
Do the above steps when you ready to make the release exe as well other wise that linker error will come.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
void hlpDoc(){
char dPath[256];
char afilename[MAX_PATH];
GetModuleFileNameA(NULL,afilename, sizeof(afilename));
PathRemoveFileSpecA(afilename);
strcpy_s (dPath,"start ");
strcat_s (dPath, afilename);
strcat_s (dPath, "\\help.chm");
system(dPath);
cout<< "\t\t Help file is loaded you can continue to the main menu \n";
}