|
-
Jul 19th, 2001, 07:34 AM
#1
Thread Starter
Fanatic Member
Invoking help
Normally, in a VB app, you can press F1 and it will bring up the help file that is specified in the project properties (App.HelpFile).
We have a completed app and we're just wanting to add help but unfortunately our application does not resond to F1 anymore.
Is there anyway to fix this?
If not, is there anyway to invoke the help file mannually (I'd rather not use a Shell command if possible)?
-
Jul 19th, 2001, 08:11 AM
#2
Member
Just add a menu item called Help, and give it the shortcut key F1. Or, if you don't want to use menus in your proggie, there is an article on VB world about hotkeys.
-
Jul 19th, 2001, 08:20 AM
#3
Thread Starter
Fanatic Member
That's not the problem.
I've got a "help" menu item but what code do I use to actually invoke the help file?
-
Jul 19th, 2001, 08:22 AM
#4
Member
I believe you can use a common dialog control. I'm a little fuzzy on it (I just make HTML files, not .hlp files), so check the VB help (go to CommonDialog control in the index).
-
Jul 19th, 2001, 08:25 AM
#5
Thread Starter
Fanatic Member
.chm files
My application doesn't work with either HLP or CHM (HTML) help files.
How do you "invoke" your html help files?
-
Jul 19th, 2001, 08:31 AM
#6
Member
ShellExecute. In fact, Simonm, try doing that. Search for ShellExecute on the forum.
-
Jul 19th, 2001, 08:36 AM
#7
-= B u g S l a y e r =-
try this:
Code:
Public Declare Function HtmlHelp Lib "Hhctrl.ocx" _
Alias "HtmlHelpA" (ByVal hWndCaller As Long, _
ByVal pszFile As String, ByVal uCommand As Long, _
ByVal dwData As Long) As Long
Public Const HH_DISPLAY_TOPIC = &H0
Public Const HH_HELP_CONTEXT = &HF
Public Function LaunchHTMLHelp(HelpFile As String, _
Optional WindowHandle As Long, Optional Topic As Long) As Boolean
'HelpFile - the path to your HTML help file.
'WindowHandle - an optional handle to the window
' that the help stems from. When
' that window is closed, help will
' also close (only when compiled).
'Topic - the help topic number you wish to call from
' your help file, if any. AKA context number.
Dim lngReturn As Long
If Len(Dir(HelpFile)) > 0 Then
If Topic = 0 Then
lngReturn = HtmlHelp(WindowHandle, HelpFile, HH_DISPLAY_TOPIC, 0)
Else
lngReturn = HtmlHelp(WindowHandle, HelpFile, HH_HELP_CONTEXT, Topic)
End If
LaunchHTMLHelp = CBool(lngReturn)
End If
End Function
hope this is what u need
-
Jul 19th, 2001, 08:37 AM
#8
Member
But does that work in Windows 95 and NT, which didn't come with .CHM support? Try ShellExecute first!
-
Jul 19th, 2001, 08:41 AM
#9
-= B u g S l a y e r =-
filburt1 it will work on most computers. well not all ... but this sample makes it possible for him to use context sensitive help.
eg.
a user is in a partic. part of the program and the user hit F1, he/she will be taken to the correct part of the helpfile...
-
Jul 19th, 2001, 08:41 AM
#10
Thread Starter
Fanatic Member
Cheers!
Thanks for all the help everyone!
-
Jul 19th, 2001, 08:42 AM
#11
-= B u g S l a y e r =-
Re: Invoking help
oh yeah, and :
Originally posted by simonm
... file mannually (I'd rather not use a Shell command if possible)?
-
Jul 19th, 2001, 08:43 AM
#12
-
Jul 19th, 2001, 08:44 AM
#13
Thread Starter
Fanatic Member
Actually...
Will HtmlHelp work on Windows 98 and Windows 2000 machines?
-
Jul 19th, 2001, 08:45 AM
#14
Member
-
Jul 19th, 2001, 08:47 AM
#15
-= B u g S l a y e r =-
-
Jul 19th, 2001, 10:00 PM
#16
New Member
Try this code. This works with .hlp files. I have not tried with .chm files.
Option Explicit
Global Const m_Help_Quit = &H2 ' Terminates help
Declare Function WinHelp Lib "User32.dll" Alias "WinHelpA" (ByVal hwnd As Long, ByVal HelpFile As String, _
ByVal Cmd As Long, ByVal Data As Any) As Long
Dim m_hWnd_Main_Window As Long ' tells WINHELP the helpfile owner
'Routine to Initialize Help
Public Sub SetAppHelp(ByVal hWnd_Main_Window)
'Setup helpfile variables
m_hWnd_Main_Window = hWnd_Main_Window
If Right$(Trim$(App.Path), 1) = "\" Then
App.HelpFile = App.Path + "HelpFilename.hlp"
Else
App.HelpFile = App.Path + "\HelpFilename.hlp"
End If
End Sub
'Quits Help
Public Sub QuitHelp()
Dim Result As Variant
Result = WinHelp(m_hWnd_Main_Window, App.HelpFile, m_Help_Quit, chr$(0) + chr$(0) + chr$(0) + chr$(0))
End Sub
'On your form load event, initialize the help file:
Private Sub Form_Load()
'Initialize help
SetAppHelp Me.hwnd
end sub
-
Sep 30th, 2001, 11:50 AM
#17
Hyperactive Member
peet, that is exactly what I have been looking for to open help files. I have one question though..... where do you set specific
values in the CHM in order for the right topic to be opened when
you call help with a parameter?
Bababooey
Tatatoothy
Mamamonkey
-
Sep 30th, 2001, 11:59 AM
#18
Frenzied Member
Use this code to open to a specific page in an CHM file.
VB Code:
Private Const HH_DISPLAY_TOPIC = &H0
Private Declare Function htmlHelpTopic Lib "hhctrl.ocx" _
Alias "HtmlHelpA" (ByVal hwnd As Long, _
ByVal lpHelpFile As String, _
ByVal wCommand As Long, _
ByVal dwData As String) As Long
Public Sub ShowHelp(hwndCaller As Long, sFile As String, sHelpPage As String)
Call htmlHelpTopic(hwndCaller, sFile, HH_DISPLAY_TOPIC, sHelpPage)
End Sub
'To Call
Private Sub mnuHelp()
Dim sHelpFile As String
sHelpFile = App.Path & "\myhelp.chm"
ShowHelp Me.hWnd, sHelpFile, "main.htm"
End Sub
Greg
Free VB Add-In - The Reference Librarian
Click Here for screen shot and download link.
-
Sep 30th, 2001, 12:06 PM
#19
Hyperactive Member
i know how to do that part, what i'm wondering is, in my CHM file which I have made, where do i put topic codes or whatever in order for the function to find the right thing?
this is on the HTML help side, not the VB side
Thanks
Bababooey
Tatatoothy
Mamamonkey
-
Sep 30th, 2001, 12:15 PM
#20
Hyperactive Member
nm, i think i got it, thx for the help!
Bababooey
Tatatoothy
Mamamonkey
-
Sep 30th, 2001, 12:17 PM
#21
Frenzied Member
In my code maybe you didn't notice that it does not rely on codes to call the topics. You call it by page name (e.g. main.htm in the example). You don't need to add any codes to your CHM help file. In the older WinHelp (HLP) files you included a topic map which assigned each topic a value.
Greg
Free VB Add-In - The Reference Librarian
Click Here for screen shot and download link.
-
Sep 30th, 2001, 12:26 PM
#22
Hyperactive Member
yes thanks, i thought it was something else maybe, but using
your method I can access specific topics using anchors and such.
Which is something i use heavily in my CHM to find different
things.
Thanks for your help!
Bababooey
Tatatoothy
Mamamonkey
-
Sep 30th, 2001, 03:41 PM
#23
-= B u g S l a y e r =-
Re: Cheesy easy way
Originally posted by James Stanich
Add a web browser control in your project and load your html help filles as needed. Only thing can you load html files in a resourse file for retrieval at runtime?
hmm... think this will be a difficult task, u will have to store all the graphics and html in u'r resource, then save it as files when u want to load it.
-
Sep 30th, 2001, 03:58 PM
#24
PowerPoster
Originally posted by peet
"peet the pimp"
Got any...girls...for me yet peet?!
-
Sep 30th, 2001, 04:15 PM
#25
-= B u g S l a y e r =-
Originally posted by chrisjk
Got any...girls...for me yet peet?!
sure Chris, you bring the gum, I'll bring the girls
-
Dec 12th, 2001, 05:17 PM
#26
Addicted Member
CHM files...
Isn't there any way to load CHM files using the CommonDialog control as done with HLP files ?
If not, what method is compatible to NT/2000/XP : calling HtmlHelp API or ShellExecute API ?
Thanks.
-
Dec 12th, 2001, 06:51 PM
#27
-= B u g S l a y e r =-
Hyperspaced, u want the users to select the helpfile using the common dialog control ?
-
Dec 13th, 2001, 03:25 PM
#28
Addicted Member
No. just a fixed help file
No. Just a fixed help file. I tried calling both ShellExecute and HtmlHelp with succesfull results in my Win98SE (clearly calling htmlHelp API is much cooler)
However, I don't know if this is the case in NT/2000/XP.
Thanks
-
Dec 13th, 2001, 03:58 PM
#29
-= B u g S l a y e r =-
the code I posted earlier in this thread works fine on NT and win2k, have not tested on xp, but I assume there won't be any problems there either.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|