Solved

Help File Question

Posted on 2000-04-12
6
163 Views
Last Modified: 2012-06-21
I've got a completed VB app

I've got a set of help files produced in RoboHELP.

My question is,

How do I reference/launch the help files from my VB app, I've tried a couple of things but they were pretty unsuccessful.

I bet somebdy out there has got some slick code just waiting to go.

Thanks for your help (in advance)

Matt.
0
Comment
Question by:Matt_Unsworth
[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
6 Comments
 
LVL 12

Expert Comment

by:mark2150
ID: 2708220
You should be able to just place the .HLP file into the directory with the project and then set the project properties to point to that file. Fin. No code required. Pressing <F1> should pop the file. Go to Project/Properties and select the General Tab. Set the Help File Name field. Save and recompile.

M
0
 
LVL 3

Accepted Solution

by:
Gordonp earned 30 total points
ID: 2708233
In the Project PRoperties dialog

set the helpfile to be the path of the
Help file you created.

you can that set the HelpContextIDs for your controls to match the appropriate context in the helpfile.


you can also use the winHelp api call to open the help file

Public Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal hwnd as Long, ByVal HelpFile as String, ByVal wCommand as Integer, dwData As Any) as Long

see
 Previously Asked Visual Basic Question  Ask a Question    Other Questions    Reload Question    
From: BarryTice  Title: "Invoking Help and Context Strings"  Points: 5  
Answer Grade: A  Date: Tuesday, April 11 2000 - 03:51PM BST    
I'm in Help File Purgatory.

I have a WinHelp file that needs to be able to link to another WinHelp file, passing a context string to direct the second file to a specific help screen. This is no problem, as long as the path to the second WinHelp file is known. This would be no problem, except I can't guarantee where the second WinHelp file will be at the client site. (Rats.)

So, I figure, I'll put together a vb app that checks a text file to see where the second WinHelp file is. The vb app and the text file are in the same directory as the first WinHelp file. The first WinHelp file has been modified to call the vb app instead, and I'm using Command() to capture the context string passed from the first WinHelp file.

So the vb app reads the text file to get the location of the second WinHelp file. I now have the path, and I have the context string.

If no context string is passed, ShellExecute does a fine job of opening the second WinHelp file. Otherwise, nothing happens.

I have the path to the second WinHelp file parsed into the path and the filename for the ShellExecute call. I'm appending the context string to the end of the filename (separated by a space), and I'm guessing that's where the trouble is.

But I'm not getting any error back. I'm assuming that's because I'm putting a zero in for hwnd in the ShellExecute call, because all the code for the program that calls ShellExecute is in a basic module, because there are no forms for the program.

So I guess I've got two questions here:
1) How can I get the hwnd of the help file window from the first WinHelp file (the one that invokes the vb app) so I have a window that ShellExecute can pass an error message back to if necessary.

2) How can I invoke the second WinHelp file, passing it a context string as I go?

More points to come, if appropriate. Thanks for any help!


 
Accepted Answer  
From: Gordonp
 Date: Tuesday, April 11 2000 - 04:27PM BST    


Text below...

Question History  
Comment  
From: Gordonp
 Date: Tuesday, April 11 2000 - 04:22PM BST  
Try the WinHelp Api rather than shellexecute

Public Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal hwnd as Long, ByVal HelpFile as String, ByVal wCommand as Integer, dwData As Any) as Long





 
Comment  
From: Gordonp
 Date: Tuesday, April 11 2000 - 04:25PM BST  
some details

HelpFile is the filepath of the help file

wCommand can be

HELP_CONTENTS 'Opens help file at contents page
HELP_INDEX 'Opens at Index Page

there are many other values, check msdn for details


 
Accepted Answer  
From: Gordonp
 Date: Tuesday, April 11 2000 - 04:27PM BST  
To pass a context string would be

Private COnst HELP_CONTEXT = 3

WinHelp Form1.hWnd,sHelpFile,HELP_CONTEXT,sContextString

Gordon


 
Comment  
From: BarryTice
 Date: Tuesday, April 11 2000 - 07:28PM BST  
Yowza, is the documentation for that API wretched!

But you've given me the starting point that I need, for which I am grateful. Thanks, Gordonp!

 
Comment  
From: BarryTice
 Date: Tuesday, April 11 2000 - 10:05PM BST  
Gordonp -- You still there?

I'm having problems getting this to work, and I'm not sure why.

Private Declare Function WinHelpContext Lib "User32" Alias "WinHelpA"  _
    (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, _
   ByVal dwData As String) As Long

Private Const HELP_CONTEXT = &H1
Private intReturn As Integer

intReturn = WinHelpContext(Me.hwnd, "I:\Hlp480\Help\95comps\INHELP.HLP", HELP_CONTEXT, "IN1012")


The help authoring software I'm using (HDK) verifies that the context string of a specific page is IN1012. But I still get the "The topic does not exist. Contact your application vendor for an updated help file. (129)" error.



When, instead, I use:

Private Declare Function WinHelpContents Lib "User32" Alias "WinHelpA" _
   (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, _
   ByVal dwData As Long) As Long

Private Const HELP_CONTENTS = &H3
Private intReturn As Integer

intReturn = WinHelpContents(Me.hwnd, "I:\Hlp480\Help\95comps\INHELP.HLP", HELP_CONTENTS, CLng(0))


the help file opens properly to the contents page.

Any ideas?

 
Comment  
From: Gordonp
 Date: Wednesday, April 12 2000 - 08:16AM BST  
I'll have a look into it and get back to you

Gordon

 
Comment  
From: Gordonp
 Date: Wednesday, April 12 2000 - 08:20AM BST  
just reread the msdn page

HELP_CONTEXT
Displays the topic identified by the specified context identifier defined in the [MAP] section of the .hpj file. UNSIGNED LONG INTEGER containing the context identifier for the topic.

It seems you need a Long and not a string, I must have misread first time through.

Hope this helps

GOrdon


 
Comment  
From: BarryTice
 Date: Wednesday, April 12 2000 - 02:35PM BST  
There is no .hpj file. There are an .fts and a .gid file, but no .hpj.

Perhaps there is one created when the help file is first compiled, but it isn't (normally) a necessary component for running the help files, so we've never distributed them before.

Meanwhile, I know the help files can be called to specific help screens without them because our main product (the one all our help files were written for) has a GUI interface based on a Seagull product, and it manages to call the help files without a problem. From what I've been able to gather from talking to our GUI guys, it does it with the "IN1012" context string. It also does it with no .hpj file.

Any other ideas on how to approach this?

Also, on which msdn page did you find the above? I'm at a bit of a disadvantage in that I can't get the msdn to load properly on my computer at work, and at home, where it does run properly, I've got more than enough other stuff to do. Maybe I can get it to install on the computer in the empty cube next door...

The only MS doc I've found so far on the WinHelp API is the Q202563 HowTo: Call Win32 WinHelp API from Visual Basic in the online knowledge base (and a related article on invoking the search in windows help from visual basic). I've not found anything useful in the msdn at all, given my limited ability to search it.

Thanks again!

 
Comment  
From: Gordonp
 Date: Wednesday, April 12 2000 - 03:04PM BST  
I got it from the MSDN that came with Visual Studio 6.

The same page in the Web is

http://msdn.microsoft.com/library/psdk/shellcc/shell/Functions/WinHelp.htm 
 
for how to use the function.

GordonP
0
 
LVL 3

Expert Comment

by:Gordonp
ID: 2708243
Dont quite know what happened there

post should be

In the Project PRoperties dialog

set the helpfile to be the path of the
Help file you created.

you can that set the HelpContextIDs for your controls to match the appropriate context in the helpfile.


you can also use the winHelp api call to open the help file

Public Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal hwnd as Long, ByVal HelpFile as String, ByVal wCommand as Integer, dwData As Any) as Long

see

http://msdn.microsoft.com/library/psdk/shellcc/shell/Functions/WinHelp.htm

for how to use this function
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 12

Expert Comment

by:mark2150
ID: 2708492
You can also pop the help dialog with CommonDialog Show.Help

M
0
 

Author Comment

by:Matt_Unsworth
ID: 2768858
Cheers
0
 

Expert Comment

by:mof2
ID: 5567693
From mof2
25/11/00

Under a command button add this code

Private Sub Command1_Click()
dummy = Shell ("winhelp.exe c:\program files\help.hlp", vbNormalFocus)

End Sub

Don't forget to declare the variable 'dummy' .

Make sure the path your help (.hlp) file is in is ok.

Of course, you can put this code under a menu if you wish

Above is just an example.
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA: Select SQL query based on a config Sheet v2 11 55
Can we place a tooltip on the actual vb6 form 5 57
IF ELSE Statement in Excel Macro VBA 16 103
RUNRMTCMD from AS/400 13 130
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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

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