Solved

help file...

Posted on 1999-01-27
6
200 Views
Last Modified: 2013-11-14
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
Comment
Question by:majala
  • 3
  • 2
6 Comments
 

Expert Comment

by:Billaban
ID: 1470880
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
 
LVL 12

Expert Comment

by:mark2150
ID: 1470881
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
 

Expert Comment

by:Billaban
ID: 1470882
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
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 

Author Comment

by:majala
ID: 1470883
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
 

Expert Comment

by:Billaban
ID: 1470884
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
 
LVL 12

Accepted Solution

by:
mark2150 earned 30 total points
ID: 1470885
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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question