Re: htmlhelp not referencing stylesheets when called from VB6 applicat
- From: "Jim Carlock" <anonymous@localhost>
- Date: Tue, 17 May 2005 11:11:36 -0400
The easy way would be to link the CSS and javascript files into each html
document. Also make sure each .html doc has the appropriate DocType
tag at the top of them?
Put the common .css and .js files in a commlib folder then reference them
in each html doc in the following manner...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html><head>
<title>Page Title</title>
<meta http-equiv="Content-type" content="text/html; charset=windows-1252" />
<meta http-equiv="Content-language" content="en-us" />
<meta http-equiv="Content-style-type" content="text/css" />
<meta http-equiv="Content-script-type" content="text/javascript" />
<link rel="style***" type="text/css" href="./commlib/styles.css" />
<script language="JavaScript" type="text/javascript" src="./commlib/global.js"></script>
There might be a way to get each .chm project to reference the css and js so
that all .htm/.html documents inside of the project are referenced, eliminating
the need to put a <link /> tag inside of each .htm file. I haven't explored nor
researched that myself, I guess I'm stuck in the base HTML mannerisms used
for all html documents. But it would be really cool if there was.
If someone else knows, perhaps they could share a way to include common
javascript (.js) and style*** (.css) files across a whole .chm project so each
html document in the project wouldn't need a separate link statement and links
could be used to change or override the default "project" styles.
I think the only adverse affect might be that the size of each .chm file would
get a little bigger because each copy holds/contains the common .css and
..js files... perhaps?
If I overlooked something, let me know. Hope that helps.
--
Jim Carlock
Please post replies to newsgroup.
"Jim McC" <jamcc@xxxxxxxxxxxxx> wrote:
Hope someone can help us. Apologies for the long post (below).
We are having problems with our merged HTML Help system (.chm file).
When accessed directly from Windows Explorer, it works fine.
When accessed from the application, the CSS and JavaScript
do not work (i.e. styles are not applied and JavaScript
functionality is not added).
Each topic contains a link in the header to a JavaScript
file and a CSS file that are contained in a separate help
file (memexshared.chm) within the merged help system. When
launched from the application, the topics are displayed
without any CSS or JavaScript - as if these files cannot be
accessed.
Example head section of a topic:
<head>
<title>User/Group Selection</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script language="JScript"
src="MS-ITS:memexshared.chm::/MemexShared.js"></script>
<link rel="style***" media="screen" type="text/css"
href="MS-ITS:memexshared.chm::/MemexScreen.css">
<link rel="style***" media="print" type="text/css"
href="MS-ITS:memexshared.chm::/MemexPrint.css">
</head>
All of the help files are contained in the same subdirectory
of the application directory.
The directory is called helpFiles and contains the files:
imadmin.chm
imadmin.chw
imadminonly.chm
imuser.chm
imuser.chw
imuseronly.chm
memexshared.chm
usinghelp.chm
The help system has two modes (user-level and
administrator-level). For the user-level help the
application opens the imuser.chm file (this merged help file
references imuseronly.chm, usinghelp.chm and
memexshared.chm). For the admin-level help the application
opens the imadmin.chm file (this references imadminonly.chm,
imuseronly.chm, usinghelp.chm and memexshared.chm).
A response to a posting on microsoft.public.helpauthoring
suggested that the reason the system works when opened
directly but not when opened by the application is because
when the application opens imadmin.chm or imuser.chm the
current working directory is the directory in which the
application .exe file resides, not the directory containing
the memexshared.chm file.
However, we have tried the following to solve this, without
success:
1) Moving all of the help files to the same directory as the
..exe and other application files.
2) Adding the helpFiles directory to the Windows Path
environment variable.
3) Registering the memexshared.chm help file in:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\HTML Help i.e. memexshared.chm
= C:\Program Files\Memex\IM\helpFiles\
4) Resetting the current working directory in VB,
immediately prior to calling HH.exe.
The VB code is held in a class module in the parent directory, and looks
like this:
Declarations:
Public Enum HtmlHelpConstants
HH_DISPLAY_TOC = &H1
HH_DISPLAY_INDEX = &H2
HH_DISPLAY_SEARCH = &H3
HH_HELP_CONTEXT = &HF
HH_CLOSE_ALL = &H12
HH_GET_LAST_ERROR = &H14
End Enum
Private Declare Function HtmlHelp Lib "hhctrl.ocx" Alias "HtmlHelpA" _
(ByVal hwnd As Long, _
ByVal lpHelpFile As String, _
ByVal wCommand As Long, _
ByVal dwData As Long) As Long
Code for setting the path to the folder containing all the .chm files:
m_sUserHelpFile = App.Path & "\helpFiles\imuser.chm"
m_sAdminHelpFile = App.Path & "\helpFiles\imadmin.chm"
Help topics are called in the following way:
For a Help > Contents call:
If blnAdmin = True Then
lresult = HtmlHelp(0, m_sAdminHelpFile, HH_DISPLAY_TOC, 0)
Else
lresult = HtmlHelp(0, m_sUserHelpFile, HH_DISPLAY_TOC, 0)
End If
Code called via the F1 key:
lresult = HtmlHelp(hwnd, m_sUserHelpFile & ">$global_ContextWindow", _
HH_HELP_CONTEXT, lngID)
We have tried the following VB fixes to solve the problem, without
success:
1) changing the current directory to the directory where the .chm files are
kept, immediately before a call to HtmlHelp:
ChDir (App.Path & "\helpFiles")
lresult = HtmlHelp(0, m_sAdminHelpFile, HH_DISPLAY_TOC, 0) (using
App.Path & "\helpFiles\" does not work either).
2) using an HH_INITIALIZE call before any calls to HtmlHelp.
The application relies on hhctrl.ocx pre-existing on the system, the version
we have is 5.2.3790.1280.
--
Any help much appreciated.
thanks,
--jim mcc
.
- References:
- Prev by Date: OT: Real estate listing
- Next by Date: Re: How to make public a picturebox in an usercontrol?
- Previous by thread: RE: htmlhelp not referencing stylesheets when called from VB6 applicat
- Next by thread: Problem with reference to an ActiveX exe file
- Index(es):