Solved

help file...

Posted on 1999-01-27
6
214 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 

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 Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vbModal 12 75
Sending email via PHP & Pear - Warning: include_once(Net/SMTP.php): failed to open stream 5 159
DCOM errors in Server 2016 2 223
Sub or Function is not defined 6 59
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

751 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