Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

help file...

I open my programs helpfile like this:
x=shell("winhelp.exe myhelp.hlp",1)

Now my program somehow try open myhelp-file somewhere else than where my application is. How can I force it to open it where my application is (I don't wanna tell hole path, something like app.path&"myhelp....)?

Thanks in advance!
0
majala
Asked:
majala
  • 3
  • 2
1 Solution
 
BillabanCommented:
One method would be to use the registry, i.e., include a string value in your installation which you presumable would set to the app path or a subordinate directory.  At runtime you query the registry and build a fully qualified path&filename string - done.

Another would be if U always know where the help file is (relative to the exe) and it cohabitates with the exe (or in a subordinate dir) U can get the path the exe (assorted methods provide this result) ensure that your current path is set to that dir and then just build a relative path to the help files, e.g., "..\helpfiles\myhelp.hlp".

My preference would be to use the registry.  Using installation tools, e.g., InstallShield make this trivial.

HTH
0
 
mark2150Commented:
Don't bother with using SHELL to pop the help. THis is long way around the horn. Set up your project to reference the help file and it'll pop every time user hits <F1>. Include the help file in the Setup Wizard build and it'll find it automatically. If you *must* pop the help programmatically, don't use SHELL to do it. Use the CommonDialog.ShowHelp method instead. Omit the path and it'll default to the program application directory.

M

0
 
BillabanCommented:
mark2150 is correct.  For help files you can wire it directly in the app.  Reserve the approach I proposed for other files that your application may need (if any).

I answered your question without pondering the task at hand.  I guess I should have my coffee before going to this web site in the morning.....


0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
majalaAuthor Commented:
I put my help file in the projects properties and it did pop up nicely just like you told me. My program deals with databases and when I open database from some other directory than where my app is, somehow when I now press <F1> program tryes to open that help file from that directory. I don't understand why it's like that?
I checked before I opened help file what is value for App.Path and it wasn't changed but still it didn't work.
If I use that CommonDialog.ShowHelp method where I have to put that help files name or how can I set in a runtime (I tryed CommonDialog.InitDir... but didn't help)?
0
 
BillabanCommented:
Well, I didn't exactly follow you discussion, but if you follow the registration approach that I described previously in order to always render fully qualified paths and filenames u shouldn't have any state dependency problems like (I think) u are describing.  

HTH
0
 
mark2150Commented:
Pass App.Path to CommonDialog.ShowHelp. Also, when you select a different directory using the ShowOpen, specify the "NOCHANGEDIR" flag:

cdlOFNNoChangeDir      &H8       Forces the dialog box to set the current directory to what it was when the dialog box was opened.

This will keep the program running from the original application directory as it's default. The .FileName will still have the path to your data file, but the programs *default* will remain right where it was.

M

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now