Help (.chm) file directory

The .Net platform makes use of .chm help files which can be launched by the System.Windows.Forms.Help class. However the Help class method call needs the directory path of the .chm file as an argument. I believe it is customery to put the .chm file in the app installation directory or its subdirectory, which is set by the user during installation. How would you programmatically find out the installation directory at run time?

Thanks

Bruce
bhomassAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mohammed NasmanSoftware DeveloperCommented:
Hello

Use Application.StartupPath

MessageBox.Show(Application.StartupPath.ToString());

Regards,
0
bhomassAuthor Commented:
Thanks for the speedy reply.

You know what, normally this would be the right answer, except the app I am doing is an Excel add-in. the Application.StartupPath returns the installation directory of Excel.exe instead of my add-in .dll path. So I still need to know the right directory from the installation process.

Thanks

Bruce
0
Mohammed NasmanSoftware DeveloperCommented:
Bruce

try this instead
MessageBox.Show(System.AppDomain.CurrentDomain.BaseDirectory.ToString());

HTH

Regards,
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

bhomassAuthor Commented:
Same result. points to Excel.exe.

Bruce
0
Mohammed NasmanSoftware DeveloperCommented:
sorry, I just test it with normal exe file

try this too
      MessageBox.Show(Application.ExecutablePath.ToString());
      MessageBox.Show(System.Reflection.Assembly.GetExecutingAssembly().Location.ToString());
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bhomassAuthor Commented:
All right. What a man!

ExecutablePath returns Excel path, but assembly location returned the .dll path.

Thanks and closed!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.