Solved

help file...

Posted on 1999-01-27
6
163 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now