Codebase/htmlHelp files problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I seem to have a small problem using html help files in .NET.

I created a program.chm file, and this one is located at the same location
of the .NET program.exe.

So I want to use following code top point to my help file:
Assembly myAssembly = Assembly.GetExecutingAssembly();
string sCodeBase=myAssembly.CodeBase;
mHelpFile=Path.ChangeExtension(sCodeBase,"chm");

And use it like this:
helpProvider1.HelpNamespace=mHelpFile;

Help.ShowHelp(this,mHelpFile,HelpNavigator.TableOfContents);
Help.ShowHelpIndex(this, mHelpFile);

Now comes the funny thing:

mHelpFile turns out to be something like this:
"file://D:/MyPath/program.chm"
Note the "file://" part!!!!

If I use winhlp files "file://D:/MyPath/program.hlp" then this works fine
but if I use the html v1.xx help files "file://D:/MyPath/program.chm" then
this does not show!
But if I remove the "file://" and have "D:/MyPath/program.chm" then it
works fine!

Does anyone know how to detect and extract this "file://" part?
The Path class does not seem to have a method to extract the "xxxx://"
parts.
I could create my own method but I prefer to use the .NET functions.
 
....
mHelpFile turns out to be something like this:
"file://D:/MyPath/program.chm"
Note the "file://" part!!!!

If I use winhlp files "file://D:/MyPath/program.hlp" then this works fine
but if I use the html v1.xx help files "file://D:/MyPath/program.chm" then
this does not show!
But if I remove the "file://" and have "D:/MyPath/program.chm" then it
works fine!

Does anyone know how to detect and extract this "file://" part?
The Path class does not seem to have a method to extract the "xxxx://"
parts.

I have current not so nice fix that works:

Assembly myAssembly = Assembly.GetExecutingAssembly();
mHelpFile=myAssembly.CodeBase;
if (mHelpFile.ToLower().StartsWith("file:///")) {
mHelpFile=mHelpFile.Substring(8,mHelpFile.Length-8);
}
mHelpFile=Path.ChangeExtension(mHelpFile,"chm");
helpProvider1.HelpNamespace=mHelpFile;


I someone have a better sulution, please tell me. :-)
 
A new problem has emerged:

helpProvider1.HelpNamespace="\\Myserver/program files/skyscan/test.chm"

It doesn't want to open my help file if I use "\\Myserver"
It does open it if I have a drive mapping "q:/program
files/skyscan/test.chm"

Anyone have a sollution for this?
 
Back
Top