Discussion:
Problem opening .chm Help File from MsgBox/InputBox
(too old to reply)
Peter
2006-11-05 00:25:01 UTC
Permalink
I cannot open a .chm help file from a VbScript MsgBox and InputBox.

When I click on the .chm file in Windows Explorer, it displays normally and
runs in hh.exe process.

My script refers to this help file in a message box and an inputbox:
MsgBox "Click Yes or No", vbYesNo, , "C:\scripts\MyHelp.chm", 1010

But when I click on the Help button, the following message appears with
"Windows Help" in the title bar:

"The document C:\scripts\MyHelp.chm is not a Windows Help file, or the file
is corrupted." In Task Manager, I see VbScript starts winhlp32.exe, I guess
to open that .chm file. (After clicking OK and the script finishes,
winhlp32.exe continues running in the background.)

So it appears VbScript expects a .hlp file.
Can I not point to a .chm help file in a VbScript message box/inputbox?

Win 2000 SP4
WSH 5.6
Help file created by HTML Workshop 4.74.8702.0
Fosco
2006-11-05 17:24:22 UTC
Permalink
Post by Peter
I cannot open a .chm help file from a VbScript MsgBox and InputBox.
When I click on the .chm file in Windows Explorer, it displays normally and
runs in hh.exe process.
MsgBox "Click Yes or No", vbYesNo, , "C:\scripts\MyHelp.chm", 1010
set oShell = CreateObject("WScript.Shell")
oShell.run"hh.exe C:\scripts\MyHelp.chm"
--
Fosco
Peter
2006-11-07 07:57:01 UTC
Permalink
Post by Fosco
set oShell = CreateObject("WScript.Shell")
oShell.run"hh.exe C:\scripts\MyHelp.chm"
I would like to have the .chm opened by the Help button on the MsgBox or
InputBox.

From documentation I found I understand the Help button can be used for
either .chm or .hlp Help files. But it does not seem to work with .chm...
Post by Fosco
MsgBox "Click Yes or No", vbYesNo, , "C:\scripts\MyHelp.chm", 1010
Can I make this work?
Post by Fosco
Post by Peter
I cannot open a .chm help file from a VbScript MsgBox and InputBox.
When I click on the .chm file in Windows Explorer, it displays normally and
runs in hh.exe process.
MsgBox "Click Yes or No", vbYesNo, , "C:\scripts\MyHelp.chm", 1010
set oShell = CreateObject("WScript.Shell")
oShell.run"hh.exe C:\scripts\MyHelp.chm"
--
Fosco
Fosco
2006-11-08 01:58:17 UTC
Permalink
"Peter"
Post by Peter
I would like to have the .chm opened by the Help button on
the MsgBox or InputBox.
Ahhh ok ..(sorry)
I can't test it here in this PC :

MsgBox function


MsgBox Function
MsgBox(prompt[, buttons][, title][, helpfile, context])
Arguments

helpfile
String expression that identifies the Help file to use to provide context-sensitive
Help for the dialog box. If helpfile
is provided, context must also be provided. Not available on 16-bit platforms.
context
Numeric expression that identifies the Help context number assigned by the
Help author to the appropriate Help topic. If
context is provided, helpfile must also be provided. Not available on 16-bit platforms.

Remarks
When both helpfile and context are provided, the user can press F1 to view
the Help topic corresponding to the context.

--------------------------------------------------------------------------------

© 2001 Microsoft Corporation. All rights reserved.
--
Fosco
Peter
2006-11-08 02:20:02 UTC
Permalink
Thx, Fosco, you got it.
Post by Fosco
Ahhh ok ..(sorry)
I know:
'MyVar = InputBox(prompt[, title][, default][, xpos][, ypos][, helpfile,
context])
'MyVar = MsgBox(prompt[, buttons][, title][, helpfile, context])

But this [, helpfile, context] does not seem to work with my .chm help file:

??? MyVar = MsgBox ("Hello World!", 65, "MsgBoxExample",
"C:\scripts\Help.chm", "1010")
generates this error: "The document C:\scripts\Help.chm is not a Windows
Help file, or the file is corrupted."

I don't understand this: In Task Manager I see VbScript starts winhlp32.exe
to open that .chm file whereas it should be opened in hh.exe, right?

So this .chm file opens normally when simply clicking on it but not from my
MsgBox in VbScript.

What is wrong here?

Win 2000 SP4
WSH 5.6
.chm made in MS HTML Help Workshop 4.74.8702.0
Post by Fosco
"Peter"
Post by Peter
I would like to have the .chm opened by the Help button on
the MsgBox or InputBox.
Ahhh ok ..(sorry)
MsgBox function
MsgBox Function
MsgBox(prompt[, buttons][, title][, helpfile, context])
Arguments
helpfile
String expression that identifies the Help file to use to provide context-sensitive
Help for the dialog box. If helpfile
is provided, context must also be provided. Not available on 16-bit platforms.
context
Numeric expression that identifies the Help context number assigned by the
Help author to the appropriate Help topic. If
context is provided, helpfile must also be provided. Not available on 16-bit platforms.
Remarks
When both helpfile and context are provided, the user can press F1 to view
the Help topic corresponding to the context.
--------------------------------------------------------------------------------
© 2001 Microsoft Corporation. All rights reserved.
--
Fosco
Fosco
2006-11-08 03:43:55 UTC
Permalink
"Peter"
Post by Peter
generates this error: "The document C:\scripts\Help.chm is not a Windows
Help file, or the file is corrupted."
Same here and I have not clue on this

I can't test this scripts here on this PC due an security update
Even run manually a simply chm file pops up an IE security allert

SORRY

ciao

--
Fosco
Fosco
2006-11-08 03:49:25 UTC
Permalink
"Peter"

Take a look on this, it's NOT wath you searching for
but maybe a little step to .. :

http://www.interclasse.com/scripts/chm.php


--
Fosco
Fosco
2006-11-08 04:03:00 UTC
Permalink
"Peter"
Post by Peter
generates this error: "The document C:\scripts\Help.chm is not a Windows
Help file, or the file is corrupted."
I don't understand this: In Task Manager I see VbScript starts winhlp32.exe
to open that .chm file whereas it should be opened in hh.exe, right?
This works here

MsgBox "Hello World!", 65, "MsgBoxExample", _
"C:\WINDOWS\WINHLP32.EXE C:\WINDOWS\HELP\AMOVIE.HLP", "1010"

Win98se
WSH 5.6

--
Fosco
Peter
2006-11-09 00:52:02 UTC
Permalink
Fosco,
It works with a .HLP file but I cannot get it work with a .CHM help file...

Why does VbScript seem to start winhlp32.exe to open a .chm file?
Is it kb896358 (MS05-026)?
Are it my parameters in [,helpfile, context]?
...?

For an inputbox you can work around by allowing the user to enter a "?" upon
which you do WshShell.Run "hh.exe MyHelp.chm".

But I am annoyed with the msgbox. You could monitor when winhlp32.exe
starts, then kill it and pass it to hh.exe... but I guess all this is not how
the Help button was intended...

Feedback much appreciated.
Post by Fosco
This works here
MsgBox "Hello World!", 65, "MsgBoxExample", _
"C:\WINDOWS\WINHLP32.EXE C:\WINDOWS\HELP\AMOVIE.HLP", "1010"
Win98se
WSH 5.6
Fosco
2006-11-09 03:45:34 UTC
Permalink
"Peter"
Post by Peter
Why does VbScript seem to start winhlp32.exe to open a .chm file?
Is it kb896358 (MS05-026)?
Maybe
Post by Peter
Feedback much appreciated.
I can't test it by myself on this pc due the kb896358 (MS05-026)
sorry
ciao

--
Fosco
Michael Harris (MVP)
2006-11-10 01:36:32 UTC
Permalink
Post by Peter
Fosco,
It works with a .HLP file but I cannot get it work with a .CHM help file...
Why does VbScript seem to start winhlp32.exe to open a .chm file?
Is it kb896358 (MS05-026)?
Are it my parameters in [,helpfile, context]?
...?
The docs don't say so explicitly but the WinHelp (*.hlp) format is the only
format supported via that MsgBox (or InputBox) argument. HtmlHelp (*.chm)
is not.
Post by Peter
For an inputbox you can work around by allowing the user to enter a
"?" upon which you do WshShell.Run "hh.exe MyHelp.chm".
But I am annoyed with the msgbox. You could monitor when winhlp32.exe
starts, then kill it and pass it to hh.exe... but I guess all this is
not how the Help button was intended...
Feedback much appreciated.
Post by Fosco
This works here
MsgBox "Hello World!", 65, "MsgBoxExample", _
"C:\WINDOWS\WINHLP32.EXE C:\WINDOWS\HELP\AMOVIE.HLP", "1010"
Win98se
WSH 5.6
--
Michael Harris
Microsoft MVP Scripting
Peter
2006-11-10 02:35:01 UTC
Permalink
Thanks a lot Michael.
Peter
Post by Michael Harris (MVP)
The docs don't say so explicitly but the WinHelp (*.hlp) format is the only
format supported via that MsgBox (or InputBox) argument. HtmlHelp (*.chm)
is not.
Fosco
2006-11-08 04:28:05 UTC
Permalink
"Peter"

http://www.devguru.com/technologies/vbscript/QuickRef/msgbox.html


HelpFile

The optional HelpFile argument is a string that specifies the help file that you wish to display. This must be either a
.chm or .hlp file.

Context

The optional Context argument specifies the help context number in the help file of the topic you wish to display. If
you have created your own custom help file, then the Context argument is mandatory.

Code:
MsgBox "Date is not valid", vbMsgBoxHelpButton, "help_folder/date_help_file.hlp", 71




--
Fosco
Fosco
2006-11-08 04:36:08 UTC
Permalink
"Fosco"
Post by Fosco
MsgBox "Date is not valid", vbMsgBoxHelpButton, "help_folder/date_help_file.hlp", 71
IMHO the above is wrong

MsgBox "Date is not valid", vbMsgBoxHelpButton,, _
"help_folder/date_help_file.hlp", 71

--
Fosco
Fosco
2006-11-07 08:32:10 UTC
Permalink
"Peter"
set oShell = CreateObject("WScript.Shell")
MyVar = MsgBox ("Hello World!", 65, "MsgBox Example")
' MyVar contains either 1 or 2, depending on which button is clicked.
If MyVar = 1 then
oShell.run"hh.exe C:\scripts\MyHelp.chm"
end if


--
Fosco
Loading...