Solved

Help File Question

Posted on 2000-04-12
6
157 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
6 Comments
 
LVL 12

Expert Comment

by:mark2150
Comment Utility
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
Comment Utility
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
Comment Utility
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 12

Expert Comment

by:mark2150
Comment Utility
You can also pop the help dialog with CommonDialog Show.Help

M
0
 

Author Comment

by:Matt_Unsworth
Comment Utility
Cheers
0
 

Expert Comment

by:mof2
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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

18 Experts available now in Live!

Get 1:1 Help Now