CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: HTMLHelp

  1. #1
    Join Date
    Jul 2001
    Posts
    15

    HTMLHelp

    I have generated a .chm file for my application. Please tell me how to associate that file with my VB application. I am not providing a context sensitive help. So from all my dialogs, if I press F1, the Help should be displayed. Please tell me how to do this.


  2. #2
    Join Date
    Sep 2001
    Location
    Elmshorn, Germany
    Posts
    8

    Re: HTMLHelp

    you have to use API Function :

    wHtmlHelp Lib "hhctrl.ocx"


    KIK

  3. #3
    Join Date
    Sep 2001
    Posts
    2

    Re: HTMLHelp

    Declare the following in ur module

    Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwData As Long) As Long

    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

    Set this value for your application

    App.HelpFile = Your help file name

    hope this helps u
    radha


  4. #4
    Join Date
    Mar 2000
    Location
    Arizona, USA
    Posts
    493

    Re: HTMLHelp

    Here is how I do it. The code for the module was written by someone else. I can't remember who.
    I think I found it on PSC but I am not sure. I works very well. It is quite long...Sorry.

    Copy this code into a Class Module:

    option Explicit
    option Compare Text

    '//public declarations
    public frm as Object
    public hwnd as Long
    public lpPrevWndFunc as Long

    public Enum PopupType
    HH_CHM_POPUP = &H1
    HH_RESOURCE_POPUP = &H2
    HH_TEXT_POPUP = &H4
    End Enum

    public Enum HHVersion
    HH_1_0 = &H10
    HH_1_1 = &H11
    HH_1_1A = &H12
    HH_1_1B = &H13
    HH_1_2 = &H14
    HH_1_21 = &H15
    HH_1_21A = &H16
    HH_1_22 = &H17
    HH_1_3 = &H18
    End Enum

    public Enum IEVersion
    IE_3_0 = &H100
    IE_3_0_OSR2 = &H101
    IE_3_01 = &H102
    IE_3_02 = &H103
    IE_4_0_PP2 = &H104
    IE_4_0 = &H105
    IE_4_01 = &H106
    IE_4_01_SP1 = &H107
    IE_4_01_SP2 = &H108
    IE_5_0_Beta1 = &H109
    IE_5_0_Beta2 = &H10A
    IE_5_0 = &H10B
    IE_5_0A = &H10C
    IE_5_0B = &H10D
    IE_5_0C = &H10E
    End Enum

    '//HTML Help Version Constants
    private Const extHH_1_0 = "4.72.7290"
    private Const extHH_1_1 = "4.72.7323"
    private Const extHH_1_1A = "4.72.7325"
    private Const extHH_1_1B = "4.72.8164.0"
    private Const extHH_1_2 = "4.73.8252"
    private Const extHH_1_21 = "4.73.8412"
    private Const extHH_1_21A = "4.73.8474"
    private Const extHH_1_22 = "4.73.8561"
    private Const extHH_1_3 = "4.74.8566"

    '//Internet Explorer Version Constants
    private Const extIE_3_0 = "4.70.1155"
    private Const extIE_3_0_OSR2 = "4.70.1158"
    private Const extIE_3_01 = "4.70.1215"
    private Const extIE_3_02 = "4.70.1300"
    private Const extIE_4_0_PP2 = "4.71.1008.3"
    private Const extIE_4_0 = "4.71.1712.5"
    private Const extIE_4_01 = "4.72.2106.7"
    private Const extIE_4_01_SP1 = "4.72.3110.03"
    private Const extIE_4_01_SP2 = "4.72.3612.1707"
    private Const extIE_5_0_Beta1 = "5.00.0518.5"
    private Const extIE_5_0_Beta2 = "5.00.0910.1308"
    private Const extIE_5_0 = "5.00.2014.213"
    private Const extIE_5_0A = "5.00.2314.1000"
    private Const extIE_5_0B = "5.00.2614.3500"
    private Const extIE_5_0C = "5.0.2717.2000"

    private Const extUNKNOWN = "unknown"

    '//HTML Help Constants
    private Const HH_DISPLAY_TOPIC = &H0 '// WinHelp equivalent
    private Const HH_DISPLAY_TOC = &H1 '// WinHelp equivalent
    private Const HH_DISPLAY_INDEX = &H2 '// WinHelp equivalent
    private Const HH_DISPLAY_SEARCH = &H3 '// WinHelp equivalent
    private Const HH_SET_WIN_TYPE = &H4
    private Const HH_GET_WIN_TYPE = &H5
    private Const HH_GET_WIN_HANDLE = &H6
    private Const HH_SYNC = &H9
    private Const HH_ADD_NAV_UI = &HA '//not currently implemented
    private Const HH_ADD_BUTTON = &HB '//not currently implemented
    private Const HH_GETBROWSER_APP = &HC '//not currently implemented
    private Const HH_KEYWORD_LOOKUP = &HD '// WinHelp equivalent
    private Const HH_DISPLAY_TEXT_POPUP = &HE '//display string resource id
    '//or text in a popup window
    '//value in dwData
    private Const HH_HELP_CONTEXT = &HF '// display mapped numeric
    private Const HH_CLOSE_ALL = &H12 '// WinHelp equivalent
    private Const HH_ALINK_LOOKUP = &H13 '// ALink version of
    '// HH_KEYWORD_LOOKUP
    private Const HH_SET_GUID = &H1A '//for Microsoft Installer -- dwData is a pointer to the GUID string

    '//HTML Help window constants. These are also used
    '//in the window definitions in HHP files
    private Const HHWIN_PROP_ONTOP = &H2 '//Top-most window (not currently implemented)
    private Const HHWIN_PROP_NOTITLEBAR = &H4 '//no title bar
    private Const HHWIN_PROP_NODEF_STYLES = &H8 '//no default window styles (only HH_WINTYPE.dwStyles)
    private Const HHWIN_PROP_NODEF_EXSTYLES = &H10 '//no default extended window styles (only HH_WINTYPE.dwExStyles)
    private Const HHWIN_PROP_TRI_PANE = &H20 '//use a tri-pane window
    private Const HHWIN_PROP_NOTB_TEXT = &H40 '//no text on toolbar buttons
    private Const HHWIN_PROP_POST_QUIT = &H80 '//post WM_QUIT message when window closes
    private Const HHWIN_PROP_AUTO_SYNC = &H100 '//automatically ssync contents and index
    private Const HHWIN_PROP_TRACKING = &H200 '//send tracking notification messages
    private Const HHWIN_PROP_TAB_SEARCH = &H400 '//include search tab in navigation pane
    private Const HHWIN_PROP_TAB_HISTORY = &H800 '//include history tab in navigation pane
    private Const HHWIN_PROP_TAB_BOOKMARKS = &H1000 '//include bookmark tab in navigation pane
    private Const HHWIN_PROP_CHANGE_TITLE = &H2000 '//Put current HTML title in title bar
    private Const HHWIN_PROP_NAV_ONLY_WIN = &H4000 '//Only display the navigation window
    private Const HHWIN_PROP_NO_TOOLBAR = &H8000 '//Don't display a toolbar
    private Const HHWIN_PROP_MENU = &H10000 '//Menu
    private Const HHWIN_PROP_TAB_ADVSEARCH = &H20000 '//Advanced FTS UI.
    private Const HHWIN_PROP_USER_POS = &H40000 '//After initial creation, user controls window size/position

    private Const HHWIN_PARAM_PROPERTIES = &H2 '//valid fsWinProperties
    private Const HHWIN_PARAM_STYLES = &H4 '//valid dwStyles
    private Const HHWIN_PARAM_EXSTYLES = &H8 '//valid dwExStyles
    private Const HHWIN_PARAM_RECT = &H10 '//valid rcWindowPos
    private Const HHWIN_PARAM_NAV_WIDTH = &H20 '//valid iNavWidth
    private Const HHWIN_PARAM_SHOWSTATE = &H40 '//valid nShowState
    private Const HHWIN_PARAM_INFOTYPES = &H80 '//valid apInfoTypes
    private Const HHWIN_PARAM_TB_FLAGS = &H100 '//valid fsToolBarFlags
    private Const HHWIN_PARAM_EXPANSION = &H200 '//valid fNotExpanded
    private Const HHWIN_PARAM_TABPOS = &H400 '//valid tabpos
    private Const HHWIN_PARAM_TABORDER = &H800 '//valid taborder
    private Const HHWIN_PARAM_HISTORY_COUNT = &H1000 '//valid cHistory
    private Const HHWIN_PARAM_CUR_TAB = &H2000 '//valid curNavType

    private Const HHWIN_BUTTON_EXPAND = &H2 '//Expand/contract button
    private Const HHWIN_BUTTON_BACK = &H4 '//Back button
    private Const HHWIN_BUTTON_FORWARD = &H8 '//Forward button
    private Const HHWIN_BUTTON_STOP = &H10 '//Stop button
    private Const HHWIN_BUTTON_REFRESH = &H20 '//Refresh button
    private Const HHWIN_BUTTON_HOME = &H40 '//Home button
    private Const HHWIN_BUTTON_BROWSE_FWD = &H80 '//not implemented
    private Const HHWIN_BUTTON_BROWSE_BCK = &H100 '//not implemented
    private Const HHWIN_BUTTON_NOTES = &H200 '//not implemented
    private Const HHWIN_BUTTON_CONTENTS = &H400 '//not implemented
    private Const HHWIN_BUTTON_SYNC = &H800 '//Locate button
    private Const HHWIN_BUTTON_OPTIONS = &H1000 '//Options button
    private Const HHWIN_BUTTON_PRINT = &H2000 '//print button
    private Const HHWIN_BUTTON_INDEX = &H4000 '//not implemented
    private Const HHWIN_BUTTON_SEARCH = &H8000 '//not implemented
    private Const HHWIN_BUTTON_HISTORY = &H10000 '//not implemented
    private Const HHWIN_BUTTON_BOOKMARKS = &H20000 '//not implemented
    private Const HHWIN_BUTTON_JUMP1 = &H40000 '//Jump1 button
    private Const HHWIN_BUTTON_JUMP2 = &H80000 '//Jump2 button
    private Const HHWIN_BUTTON_ZOOM = &H100000 '//Font sizing button
    private Const HHWIN_BUTTON_TOC_NEXT = &H200000 '//Browse next TOC topic button
    private Const HHWIN_BUTTON_TOC_PREV = &H400000 '//Browse previous TOC topic button

    '//Default button set
    private Const HHWIN_DEF_BUTTONS = _
    (HHWIN_BUTTON_EXPAND Or _
    HHWIN_BUTTON_BACK Or _
    HHWIN_BUTTON_OPTIONS Or _
    HHWIN_BUTTON_PRINT)

    '//Button IDs
    private Const IDTB_EXPAND = 200
    private Const IDTB_CONTRACT = 201
    private Const IDTB_STOP = 202
    private Const IDTB_REFRESH = 203
    private Const IDTB_BACK = 204
    private Const IDTB_HOME = 205
    private Const IDTB_SYNC = 206
    private Const IDTB_PRINT = 207
    private Const IDTB_OPTIONS = 208
    private Const IDTB_FORWARD = 209
    private Const IDTB_NOTES = 210 '//not implemented
    private Const IDTB_BROWSE_FWD = 211
    private Const IDTB_BROWSE_BACK = 212
    private Const IDTB_CONTENTS = 213 '//not implemented
    private Const IDTB_INDEX = 214 '//not implemented
    private Const IDTB_SEARCH = 215 '//not implemented
    private Const IDTB_HISTORY = 216 '//not implemented
    private Const IDTB_BOOKMARKS = 217 '//not implemented
    private Const IDTB_JUMP1 = 218
    private Const IDTB_JUMP2 = 219
    private Const IDTB_CUSTOMIZE = 221
    private Const IDTB_ZOOM = 222
    private Const IDTB_TOC_NEXT = 223
    private Const IDTB_TOC_PREV = 224

    private Enum HHACT_
    HHACT_TAB_CONTENTS
    HHACT_TAB_INDEX
    HHACT_TAB_SEARCH
    HHACT_TAB_HISTORY
    HHACT_TAB_FAVORITES

    HHACT_EXPAND
    HHACT_CONTRACT
    HHACT_BACK
    HHACT_FORWARD
    HHACT_STOP
    HHACT_REFRESH
    HHACT_HOME
    HHACT_SYNC
    HHACT_OPTIONS
    HHACT_PRINT
    HHACT_HIGHLIGHT
    HHACT_CUSTOMIZE
    HHACT_JUMP1
    HHACT_JUMP2
    HHACT_ZOOM
    HHACT_TOC_NEXT
    HHACT_TOC_PREV
    HHACT_NOTES

    HHACT_LAST_ENUM
    End Enum

    private Enum HHWIN_NAVTYPE_
    HHWIN_NAVTYPE_TOC
    HHWIN_NAVTYPE_INDEX
    HHWIN_NAVTYPE_SEARCH
    HHWIN_NAVTYPE_HISTORY '//not implemented
    HHWIN_NAVTYPE_FAVORITES '//not implemented
    End Enum

    Enum HHWIN_NAVTAB_
    HHWIN_NAVTAB_TOP
    HHWIN_NAVTAB_LEFT
    HHWIN_NAVTAB_BOTTOM
    End Enum

    private Const HH_MAX_TABS = 19 '//maximum number of tabs

    private Enum HH_TAB_
    HH_TAB_CONTENTS
    HH_TAB_INDEX
    HH_TAB_SEARCH
    HH_TAB_HISTORY
    HH_TAB_FAVORITES
    End Enum

    private Type RECT
    Left as Long
    Top as Long
    Right as Long
    Bottom as Long
    End Type

    private Type tagHH_WINTYPE
    cbStruct as Long '//IN: size of this structure including all Information Types
    fUniCodeStrings as Long '//IN/OUT: true if all strings are in UNICODE
    pszType as string '//IN/OUT: Name of a type of window
    fsValidMembers as Long '//IN: Bit flag of valid members (HHWIN_PARAM_)
    fsWinProperties as Long '//IN/OUT: Properties/attributes of the window (HHWIN_)
    pszCaption as string '//IN/OUT: Window title
    dwStyles as Long '//IN/OUT: Window styles
    dwExStyles as Long '//IN/OUT: Extended Window styles
    rcWindowPos as RECT '//IN: Starting position, OUT: current position
    nShowState as Long '//IN: show state (e.g., SW_SHOW)
    hwndHelp as Long '//OUT: window handle
    hwndCaller as Long '//OUT: who called this window
    paInfoTypes as Long '//IN: Pointer to an array of Information Types

    '//The following members are only valid if HHWIN_PROP_TRI_PANE is set

    hwndToolBar as Long '//OUT: toolbar window in tri-pane window
    hwndNavigation as Long '//OUT: navigation window in tri-pane window
    hwndHTML as Long '//OUT: window displaying HTML in tri-pane window
    iNavWidth as Long '//IN/OUT: width of navigation window
    rcHTML as RECT '//OUT: HTML window coordinates

    pszToc as string '//IN: Location of the table of contents file
    pszIndex as string '//IN: Location of the index file
    pszFile as string '//IN: Default location of the html file
    pszHome as string '//IN/OUT: html file to display when Home button is clicked
    fsToolBarFlags as Long '//IN: flags controling the appearance of the toolbar
    fNotExpanded as Long '//IN: true/false to contract or expand, OUT: current state
    curNavType as Long '//IN/OUT: UI to display in the navigational pane
    tabpos as HHWIN_NAVTAB_ '//IN/OUT: HHWIN_NAVTAB_TOP, HHWIN_NAVTAB_LEFT, or HHWIN_NAVTAB_BOTTOM
    idNotify as Long '//IN: ID to use for WM_NOTIFY messages
    tabOrder(HH_MAX_TABS) as Byte '//IN/OUT: tab order: Contents, Index, Search, History, Favorites, Reserved 1-5, Custom tabs
    cHistory as Long '//IN/OUT: number of history items to keep (default is 30)
    pszJump1 as string '//Text for HHWIN_BUTTON_JUMP1
    pszJump2 as string '//Text for HHWIN_BUTTON_JUMP2
    pszUrlJump1 as string '//URL for HHWIN_BUTTON_JUMP1
    pszUrlJump2 as string '//URL for HHWIN_BUTTON_JUMP2
    rcMinSize as RECT '//Minimum size for window (ignored in version 1)
    cbInfoTypes as Long '//size of paInfoTypes;
    End Type

    '//UDT for mouse cursor position
    private Type POINTAPI
    X as Long
    Y as Long
    End Type

    '//UDT for text popups
    private Type tagHH_POPUP
    cbStruct as Integer '//sizeof this structure
    hinst as Long '//instance handle for string resource
    idString as Long '//string resource id, or text id if pszFile
    '//is specified in HtmlHelp call
    pszText as string '//used if idString is zero
    pt as POINTAPI '//top center of popup window
    clrForeground as ColorConstants '//either use VB constant or &HBBGGRR
    clrBackground as ColorConstants '//either use VB constant or &HBBGGRR
    rcMargins as RECT '//amount of space between edges of window and
    '//text, -1 for each member to ignore
    pszFont as string '//facename, point size, char set, BOLD ITALIC
    '//UNDERLINE
    End Type

    '//UDT for keyword and ALink searches
    private Type tagHH_AKLINK
    cbStruct as Long
    fReserved as Boolean
    pszKeywords as string
    pszUrl as string
    pszMsgText as string
    pszMsgTitle as string
    pszWindow as string
    fIndexOnFail as Boolean
    End Type

    '//UDT for accessing the Search tab
    private Type tagHH_FTS_QUERY
    cbStruct as Long
    fUniCodeStrings as Long
    pszSearchQuery as string
    iProximity as Long
    fStemmedSearch as Long
    fTitleOnly as Long
    fExecute as Long
    pszWindow as string
    End Type

    '//Constants for converting the cursor to What's This Help
    private Const WM_SYSCOMMAND = &H112
    private Const SC_CONTEXTHELP = &HF180&

    '//Message Box Constants
    private Const MB_ABORTRETRYIGNORE = &H2&
    private Const MB_APPLMODAL = &H0&
    private Const MB_COMPOSITE = &H2
    private Const MB_DEFAULT_DESKTOP_ONLY = &H20000
    private Const MB_DEFBUTTON1 = &H0&
    private Const MB_DEFBUTTON2 = &H100&
    private Const MB_DEFBUTTON3 = &H200&
    private Const MB_DEFMASK = &HF00&
    private Const MB_ICONASTERISK = &H40&
    private Const MB_ICONEXCLAMATION = &H30&
    private Const MB_ICONHAND = &H10&
    private Const MB_ICONINFORMATION = MB_ICONASTERISK
    private Const MB_ICONMASK = &HF0&
    private Const MB_ICONQUESTION = &H20&
    private Const MB_ICONSTOP = MB_ICONHAND
    private Const MB_MISCMASK = &HC000&
    private Const MB_MODEMASK = &H3000&
    private Const MB_NOFOCUS = &H8000&
    private Const MB_OK = &H0&
    private Const MB_OKCANCEL = &H1&
    private Const MB_PRECOMPOSED = &H1
    private Const MB_RETRYCANCEL = &H5&
    private Const MB_SETFOREGROUND = &H10000
    private Const MB_SYSTEMMODAL = &H1000&
    private Const MB_TASKMODAL = &H2000&
    private Const MB_TYPEMASK = &HF&
    private Const MB_USEGLYPHCHARS = &H4
    private Const MB_YESNO = &H4&
    private Const MB_YESNOCANCEL = &H3&

    '//Registry API call Constants
    private Const HKEY_LOCAL_MACHINE = &H80000002
    private Const ERROR_SUCCESS = 0&
    private Const STANDARD_RIGHTS_ALL = &H1F0000
    private Const KEY_QUERY_VALUE = &H1
    private Const KEY_SET_VALUE = &H2
    private Const KEY_CREATE_SUB_KEY = &H4
    private Const KEY_ENUMERATE_SUB_KEYS = &H8
    private Const KEY_NOTIFY = &H10
    private Const KEY_CREATE_LINK = &H20
    private Const SYNCHRONIZE = &H100000
    private Const KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL Or KEY_QUERY_VALUE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY Or KEY_CREATE_LINK) And (Not SYNCHRONIZE))

    private Const MAX_PATH = 260
    private Const INVALID_HANDLE_VALUE = -1

    '//RegCreateKeyEx options
    private Const REG_OPTION_NON_VOLATILE = 0

    '//Registry data types
    private Const REG_NONE = 0
    private Const REG_SZ = 1
    private Const REG_EXPAND_SZ = 2
    private Const REG_BINARY = 3
    private Const REG_DWORD = 4

    '//FindFirstFile return values
    private Const ERROR_FILE_NOT_FOUND = 2&
    private Const ERROR_MORE_DATA = 234
    private Const ERROR_NO_MORE_ITEMS = 259&

    '//Constants for Registry top-level keys
    private Const HKEY_CURRENT_USER = &H80000001
    private Const HKEY_USERS = &H80000003
    private Const HKEY_DYN_DATA = &H80000006
    private Const HKEY_CURRENT_CONFIG = &H80000005
    private Const HKEY_CLASSES_ROOT = &H80000000

    private Const MAX_SIZE = 2048
    private Const MAX_INISIZE = 8192

    private Const GWL_STYLE = (-16)
    private Const GWL_EXSTYLE = (-20)
    private Const GWL_WNDPROC = (-4)

    '//Constants for GetLongPath_Legacy
    private Const SINGLE_QUOTE = """"

    '//Constants for determining OS
    private Const VER_PLATFORM_WIN32s = 0
    private Const VER_PLATFORM_WIN32_WINDOWS = 1
    private Const VER_PLATFORM_WIN32_NT = 2

    private Const UNKNOWN_OS = 0
    private Const WINDOWS_NT_3_51 = 1
    private Const WINDOWS_95 = 2
    private Const WINDOWS_NT_4 = 3
    private Const WINDOWS_98 = 4
    private Const WINDOWS_2000 = 5

    '//UDT for determining OS
    private Type OSVERSIONINFO
    dwOSVersionInfoSize as Long
    dwMajorVersion as Long
    dwMinorVersion as Long
    dwBuildNumber as Long
    dwPlatformId as Long
    szCSDVersion as string * 128
    End Type

    '//UDT for message box API calls
    private Type MSGBOXPARAMS
    cbSize as Long
    hWndOwner as Long
    hInstance as Long
    lpszText as string
    lpszCaption as string
    dwStyle as Long
    lpszIcon as string
    dwContextHelpId as Long
    lpfnMsgBoxCallback as Long
    dwLanguageId as Long
    End Type

    '//Registry UDT's
    private Type SECURITY_ATTRIBUTES
    nLength as Long
    lpSecurityDescriptor as Long
    bInheritHandle as Long
    End Type

    private Type HH_REG_VALUES
    pszFileName as string
    pszFilePath as string
    End Type

    private Type FILETIME
    dwLowDateTime as Long
    dwHighDateTime as Long
    End Type

    private Type WIN32_FIND_DATA
    dwFileAttributes as Long
    ftCreationTime as FILETIME
    ftLastAccessTime as FILETIME
    ftLastWriteTime as FILETIME
    nFileSizeHigh as Long
    nFileSizeLow as Long
    dwReserved0 as Long
    dwReserved1 as Long
    cFileName as string * MAX_PATH
    cAlternate as string * 14
    End Type

    private Type VS_FIXEDFILEINFO
    dwSignature as Long
    dwStrucVersionl as Integer '// e.g. = &h0000 = 0
    dwStrucVersionh as Integer '// e.g. = &h0042 = .42
    dwFileVersionMSl as Integer '// e.g. = &h0003 = 3
    dwFileVersionMSh as Integer '// e.g. = &h0075 = .75
    dwFileVersionLSl as Integer '// e.g. = &h0000 = 0
    dwFileVersionLSh as Integer '// e.g. = &h0031 = .31
    dwProductVersionMSl as Integer '// e.g. = &h0003 = 3
    dwProductVersionMSh as Integer '// e.g. = &h0010 = .1
    dwProductVersionLSl as Integer '// e.g. = &h0000 = 0
    dwProductVersionLSh as Integer '// e.g. = &h0031 = .31
    dwFileFlagsMask as Long '// = &h3F for version "0.42"
    dwFileFlags as Long '// e.g. VFF_DEBUG Or VFF_PRERELEASE
    dwFileOS as Long '// e.g. VOS_DOS_WINDOWS16
    dwFileType as Long '// e.g. VFT_DRIVER
    dwFileSubtype as Long '// e.g. VFT2_DRV_KEYBOARD
    dwFileDateMS as Long '// e.g. 0
    dwFileDateLS as Long '// e.g. 0
    End Type

    '//HTML Help API declarations
    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

    private Declare Function HTMLHelpCallSearch Lib "hhctrl.ocx" _
    Alias "HtmlHelpA" (byval hwnd as Long, _
    byval lpHelpFile as string, _
    byval wCommand as Long, _
    byref dwData as tagHH_FTS_QUERY) as Long

    private Declare Function HTMLHelpKeyWord Lib "hhctrl.ocx" _
    Alias "HtmlHelpA" (byval hwnd as Long, _
    byval lpHelpFile as string, _
    byval wCommand as Long, _
    dwData as tagHH_AKLINK) as Long

    private Declare Function htmlHelpTextPopup Lib "hhctrl.ocx" _
    Alias "HtmlHelpA" (byval hwnd as Long, _
    byval lpHelpFile as string, _
    byval wCommand as Long, _
    byref dwData as tagHH_POPUP) as Long

    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

    '//Subclassing API declarations
    private Declare Function DefWindowProc Lib "user32" _
    Alias "DefWindowProcA" (byval hwnd as Long, _
    byval wMsg as Long, _
    byval wParam as Long, _
    byval lParam as Long) as Long

    '//Registry API declarations
    private Declare Function RegCreateKeyEx Lib "advapi32.dll" _
    Alias "RegCreateKeyExA" (byval hKey as Long, _
    byval lpSubKey as string, _
    byval Reserved as Long, _
    byval lpClass as string, _
    byval dwOptions as Long, _
    byval samDesired as Long, _
    lpSecurityAttributes as SECURITY_ATTRIBUTES, _
    phkResult as Long, _
    lpdwDisposition as Long) as Long

    private Declare Function ExpandEnvironmentStrings _
    Lib "kernel32" Alias "ExpandEnvironmentStringsA" _
    (byval lpSrc as string, _
    byval lpDst as string, _
    byval nSize as Long) as Long

    private Declare Function RegCloseKey Lib "advapi32.dll" _
    (byval hKey as Long) as Long

    private Declare Function RegDeleteValue Lib "advapi32.dll" _
    Alias "RegDeleteValueA" _
    (byval hKey as Long, _
    byval lpValueName as string) as Long

    private Declare Function RegEnumKey Lib "advapi32.dll" _
    Alias "RegEnumKeyA" _
    (byval hKey as Long, _
    byval dwIndex as Long, _
    byval lpName as string, _
    byval cbName as Long) as Long

    private Declare Function RegEnumValue Lib "advapi32.dll" _
    Alias "RegEnumValueA" _
    (byval hKey as Long, _
    byval dwIndex as Long, _
    byval lpValueName as string, _
    lpcbValueName as Long, _
    byval lpReserved as Long, _
    lpType as Long, _
    lpData as Any, _
    lpcbData as Long) as Long

    private Declare Function RegOpenKeyEx Lib "advapi32.dll" _
    Alias "RegOpenKeyExA" (byval hKey as Long, _
    byval lpSubKey as string, _
    byval ulOptions as Long, _
    byval samDesired as Long, _
    phkResult as Long) as Long

    private Declare Function RegQueryValue Lib "advapi32.dll" _
    Alias "RegQueryValueA" _
    (byval hKey as Long, _
    byval lpSubKey as string, _
    byval lpValue as string, _
    lpcbValue as Long) as Long

    private Declare Function RegQueryValueEx Lib "advapi32.dll" _
    Alias "RegQueryValueExA" (byval hKey as Long, _
    byval lpValueName as string, _
    byval lpReserved as Long, _
    lpType as Long, lpData as Any, _
    lpcbData as Long) as Long

    private Declare Function RegSetValueEx Lib "advapi32.dll" _
    Alias "RegSetValueExA" _
    (byval hKey as Long, _
    byval lpValueName as string, _
    byval Reserved as Long, _
    byval dwType as Long, _
    lpData as Any, _
    byval cbData as Long) as Long

    '//Calls to find actual file
    private Declare Function FindClose Lib "kernel32" _
    (byval hFindFile as Long) as Long

    private Declare Function FindFirstFile Lib "kernel32" _
    Alias "FindFirstFileA" (byval lpFileName as string, _
    lpFindFileData as WIN32_FIND_DATA) as Long

    '//Declarations to retrieve version information
    private Declare Function GetFileVersionInfo& _
    Lib "version.dll" Alias "GetFileVersionInfoA" _
    (byval lptstrFilename as string, _
    byval dwHandle as Long, _
    byval dwLen as Long, _
    lpData as Byte)

    private Declare Function GetFileVersionInfoSize& _
    Lib "version.dll" Alias "GetFileVersionInfoSizeA" _
    (byval lptstrFilename as string, _
    lpdwHandle as Long)

    private Declare Function VerQueryValue& Lib "version.dll" _
    Alias "VerQueryValueA" _
    (pBlock as Byte, _
    byval lpSubBlock as string, _
    lpBuffer as Long, _
    puLen as Long)

    '//Declaration to copy memory contents from one area to another
    private Declare Sub CopyMem Lib "kernel32" _
    Alias "RtlMoveMemory" _
    (Destination as Any, _
    Source as Any, _
    byval Length as Long)

    '//Call to get the current mouse position
    private Declare Function GetCursorPos& Lib "user32" _
    (lpPoint as POINTAPI)

    '//Call to translate short file path to long file path
    '//(Win98 and Win2k and above only - see comments for the
    '//GetLongFilePath_Legacy procedure)
    private Declare Function GetLongPathName Lib "kernel32" _
    (byref pszShortPath as string, _
    byref lpszLongPath as string, _
    byval cchBuffer as Long) as Long

    '//Call to determine OS version
    private Declare Function GetVersionExA Lib "kernel32" _
    (lpVersionInformation as OSVERSIONINFO) as Integer

    '//Message box API declaration
    private Declare Function MessageBoxIndirect Lib "user32" _
    Alias "MessageBoxIndirectA" _
    (lpMsgBoxParams as MSGBOXPARAMS) as Long

    'local variable(s) to hold property value(s)
    private mvarCHMFile as string
    private mvarHHALink as string
    private mvarHHDefaultURL as string
    private mvarHHInstalled as Boolean
    private mvarHHKeyword as string
    private mvarHHMsgText as string
    private mvarHHMsgTitle as string
    private mvarHHShowOnTop as Boolean
    private mvarHHTopicID as Long
    private mvarHHTopicURL as string
    private mvarHHWindow as string
    private mvarHHRegFileName as string
    private mvarHHRegFilePath as string
    private mvarHHRegFileExists as Boolean
    private mvarHHPopupFile as string
    private mvarHHPopupType as PopupType
    private mvarHHPopupText as string
    private mvarHHPopupID as Long
    private mvarHHPopupTextColor as Long
    private mvarHHPopupBackColor as Long
    private mvarHHPopupCustomTextColor as Long
    private mvarHHPopupCustomBackColor as Long
    private mvarHHPopupCustomColors as Boolean
    private mvarHHPopupTextFont as string
    private mvarHHPopupTextSize as string
    private mvarHHPopupTextBold as Boolean
    private mvarHHPopupTextItalic as Boolean
    private mvarHHPopupTextUnderline as Boolean
    private mvarHHCtrlPath as string
    private mvarHHVersion as string
    private mvarIEVersion as string
    private mvarHHFriendlyName as string
    private mvarIEFriendlyName as string

    '//Module-level variables
    private strHTMLHelpPath as string
    private strWindow as string
    private strTopic as string
    private lngTopicID as Long

    public Sub HHDisplayTopicURL(optional byref CallingForm as Long)

    '//Displays a specific topic via the HHTopicURL property

    on error GoTo ErrHandler

    Dim hwnd as Long

    If ValidHHFile(mvarCHMFile) = false then
    Exit Sub
    End If

    If EnsureFileExists(mvarCHMFile) = false then
    Exit Sub
    End If

    If Trim(mvarHHWindow) = "" then
    If mvarHHShowOnTop then
    htmlHelpTopic CallingForm, mvarCHMFile, _
    HH_DISPLAY_TOPIC, mvarHHTopicURL
    else
    htmlHelpTopic hwnd, mvarCHMFile, _
    HH_DISPLAY_TOPIC, mvarHHTopicURL
    End If
    else
    If mvarHHShowOnTop then
    htmlHelpTopic CallingForm, mvarCHMFile & ">" & mvarHHWindow, _
    HH_DISPLAY_TOPIC, mvarHHTopicURL
    else
    htmlHelpTopic hwnd, mvarCHMFile & ">" & mvarHHWindow, _
    HH_DISPLAY_TOPIC, mvarHHTopicURL
    End If
    End If

    Exit Sub

    ErrHandler:

    Select Case Err.Number
    Case 91
    MessageBoxExclamation "The HHDisplayContents method was called " & _
    "without a form being specified, while HHShowOnTop " & _
    "was set to true."
    Exit Sub
    Case else
    resume next
    End Select

    End Sub

    public Sub HHDisplayTopicID(optional CallingForm as Long)

    '//Displays a specific topic via the HHTopicID property

    on error GoTo ErrHandler

    Dim hwnd as Long

    If ValidHHFile(mvarCHMFile) = false then
    Exit Sub
    End If

    If EnsureFileExists(mvarCHMFile) = false then
    Exit Sub
    End If

    If Trim(mvarHHWindow) = "" then
    If mvarHHShowOnTop then
    HTMLHelp CallingForm, mvarCHMFile, _
    HH_HELP_CONTEXT, mvarHHTopicID
    else
    HTMLHelp hwnd, mvarCHMFile, _
    HH_HELP_CONTEXT, mvarHHTopicID
    End If
    else
    If mvarHHShowOnTop then
    HTMLHelp CallingForm, mvarCHMFile & ">" & mvarHHWindow, _
    HH_HELP_CONTEXT, mvarHHTopicID
    else
    HTMLHelp hwnd, mvarCHMFile & ">" & mvarHHWindow, _
    HH_HELP_CONTEXT, mvarHHTopicID
    End If
    End If

    Exit Sub

    ErrHandler:

    Select Case Err.Number
    Case 91
    MessageBoxExclamation "The HHDisplayContents method was called " & _
    "without a form being specified, while HHShowOnTop " & _
    "was set to true."
    Exit Sub
    Case else
    resume next
    End Select

    End Sub

    public Sub HHDisplaySearch(optional byref CallingForm as Long)

    '//Forces the Help window to display the Search tab

    on error GoTo ErrHandler

    Dim hwnd as Long

    If ValidHHFile(mvarCHMFile) = false then
    Exit Sub
    End If

    If EnsureFileExists(mvarCHMFile) = false then
    Exit Sub
    End If

    Dim HH_FTS_QUERY as tagHH_FTS_QUERY

    With HH_FTS_QUERY
    .cbStruct = len(HH_FTS_QUERY)
    .fStemmedSearch = 0&
    .fTitleOnly = 0&
    .fUniCodeStrings = 0&
    .iProximity = 0&
    .pszSearchQuery = ""
    .pszWindow = ""
    .fExecute = 1&
    End With

    If Trim(mvarHHWindow) = "" then
    If mvarHHShowOnTop then
    HTMLHelpCallSearch CallingForm, _
    mvarCHMFile, _
    HH_DISPLAY_SEARCH, HH_FTS_QUERY
    else
    HTMLHelpCallSearch hwnd, _
    mvarCHMFile, _
    HH_DISPLAY_SEARCH, HH_FTS_QUERY
    End If
    else
    If mvarHHShowOnTop then
    HTMLHelpCallSearch CallingForm, _
    mvarCHMFile & ">" & mvarHHWindow, _
    HH_DISPLAY_SEARCH, HH_FTS_QUERY
    else
    HTMLHelpCallSearch hwnd, _
    mvarCHMFile & ">" & mvarHHWindow, _
    HH_DISPLAY_SEARCH, HH_FTS_QUERY
    End If
    End If
    Exit Sub

    ErrHandler:

    Select Case Err.Number
    Case 91
    MessageBoxExclamation "The HHDisplayContents method was called " & _
    "without a form being specified, while HHShowOnTop " & _
    "was set to true."
    Exit Sub
    Case else
    resume next
    End Select

    End Sub

    public Sub HHDisplayKeyword(optional byref CallingForm as Long)

    '//Displays a topic specified by the HHKeyword property.
    '//This will search for a KLink keyword in the topics
    '//themselves. Also searches the entries of an Index
    '//file (*.hhk) used in a tripane window.

    on error GoTo ErrHandler

    Dim hwnd as Long

    If ValidHHFile(mvarCHMFile) = false then
    Exit Sub
    End If

    If EnsureFileExists(mvarCHMFile) = false then
    Exit Sub
    End If

    If mvarHHShowOnTop then
    htmlHelpTopic CallingForm, mvarCHMFile, _
    HH_DISPLAY_TOPIC, vbNullString
    else
    htmlHelpTopic hwnd, mvarCHMFile, _
    HH_DISPLAY_TOPIC, vbNullString
    End If

    Dim ALinkStruct as tagHH_AKLINK

    ALinkStruct.cbStruct = len(ALinkStruct)
    ALinkStruct.fReserved = false
    ALinkStruct.pszKeywords = mvarHHKeyword

    '//Translate empty strings to null strings
    If mvarHHDefaultURL = "" then
    mvarHHDefaultURL = vbNullString
    End If

    If mvarHHMsgText = "" then
    mvarHHMsgText = vbNullString
    End If

    If mvarHHMsgTitle = "" then
    mvarHHMsgTitle
    Kris
    Software Engineer
    Phoenix, AZ USA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured