呵呵,算你幸运,把例子中的 .CHM 路径适当替换一下:PUBLIC.BAS:
==================================================
Option Explicit'hWnd
'WINAPI
'HtmlHelpA(
'    HWND hwndCaller,
'    LPCSTR pszFile,
'    UINT uCommand,
'    DWORD_PTR dwData
'    );
'
'#define HH_DISPLAY_TOPIC        0x0000
'#define HH_HELP_FINDER          0x0000  // WinHelp equivalent
'#define HH_DISPLAY_TOC          0x0001
'#define HH_DISPLAY_INDEX        0x0002
'#define HH_DISPLAY_SEARCH       0x0003Public Declare Function HTMLHELP Lib "HHCTRL.OCX" Alias "HtmlHelpA" ( _
    ByVal hwndCaller As Long, _
    ByVal pszFile As String, _
    ByVal uCommand As Long, _
    ByVal dwData As Any) As Long
    
Public Const HH_DISPLAY_TOPIC = 0
Public Const HH_HELP_FINDER = 0
Public Const HH_DISPLAY_TOC = 1
Public Const HH_DISPLAY_INDEX = 2
Public Const HH_DISPLAY_SEARCH = 3'typedef struct tagHH_FTS_QUERY
Type HH_FTS_QUERY
'    int cbStruct;            // Sizeof structure in bytes.
    cbStruct As Long
'    BOOL fUniCodeStrings;    // TRUE if all strings are unicode.
    fUniCodeStrings As Long
'    LPCTSTR pszSearchQuery;  // String containing the search query.
    pszSearchQuery As String
'    LONG iProximity;         // Word proximity.
    iProximity As Long
'    BOOL fStemmedSearch;     // TRUE for StemmedSearch only.
    fStemmedSearch As Long
'    BOOL fTitleOnly;         // TRUE for Title search only.
    fTitleOnly As Long
'    BOOL fExecute;           // TRUE to initiate the search.
    fExecute As Long
'    LPCTSTR pszWindow;       // Window to display in
    pszWindow As String
'} HH_FTS_QUERY;
End TypefrmMain.FRM:
==================================================
Option ExplicitPrivate Sub Command1_Click()
    Dim h As Long
    Dim strTopic As String
    
    strTopic = "abort method"
    h = HTMLHELP(Me.hWnd, "C:\My Documents\BOOKS\xmlsdk25.chm", HH_DISPLAY_INDEX, strTopic)
    Debug.Print h
End SubPrivate Sub Command2_Click()
    Dim h As Long
    
    h = HTMLHELP(Me.hWnd, "C:\My Documents\BOOKS\xmlsdk25.chm::/htm/xmmscxmldomenumeratedconstants.htm", HH_DISPLAY_TOPIC, vbNullString)
    Debug.Print h
End SubPrivate Sub Command3_Click()
    Dim h As Long
    Dim qry As HH_FTS_QUERY
    
    qry.cbStruct = Len(qry)
    qry.fExecute = False
    qry.fStemmedSearch = False
    qry.fTitleOnly = False
    qry.fUniCodeStrings = False
    qry.iProximity = 0
    qry.pszSearchQuery = "XML AND XSL"
    qry.pszWindow = ""
    h = HTMLHELP(Me.hWnd, "C:\My Documents\BOOKS\xmlsdk25.chm", HH_DISPLAY_SEARCH, VarPtr(qry))
    Debug.Print h
End Sub如果你需要其他常量或结构,你要安装 HtmlHelp Workshop,VB 6 安装盘上有;安装之后,在安装目录查找 HTMLHELP.H。自己写 C 到 VB 的转换吧,这也是我自己转换的。

解决方案 »

  1.   

    呵呵,算你幸运,把例子中的 .CHM 路径适当替换一下:PUBLIC.BAS:
    ==================================================
    Option Explicit'hWnd
    'WINAPI
    'HtmlHelpA(
    '    HWND hwndCaller,
    '    LPCSTR pszFile,
    '    UINT uCommand,
    '    DWORD_PTR dwData
    '    );
    '
    '#define HH_DISPLAY_TOPIC        0x0000
    '#define HH_HELP_FINDER          0x0000  // WinHelp equivalent
    '#define HH_DISPLAY_TOC          0x0001
    '#define HH_DISPLAY_INDEX        0x0002
    '#define HH_DISPLAY_SEARCH       0x0003Public Declare Function HTMLHELP Lib "HHCTRL.OCX" Alias "HtmlHelpA" ( _
        ByVal hwndCaller As Long, _
        ByVal pszFile As String, _
        ByVal uCommand As Long, _
        ByVal dwData As Any) As Long
        
    Public Const HH_DISPLAY_TOPIC = 0
    Public Const HH_HELP_FINDER = 0
    Public Const HH_DISPLAY_TOC = 1
    Public Const HH_DISPLAY_INDEX = 2
    Public Const HH_DISPLAY_SEARCH = 3'typedef struct tagHH_FTS_QUERY
    Type HH_FTS_QUERY
    '    int cbStruct;            // Sizeof structure in bytes.
        cbStruct As Long
    '    BOOL fUniCodeStrings;    // TRUE if all strings are unicode.
        fUniCodeStrings As Long
    '    LPCTSTR pszSearchQuery;  // String containing the search query.
        pszSearchQuery As String
    '    LONG iProximity;         // Word proximity.
        iProximity As Long
    '    BOOL fStemmedSearch;     // TRUE for StemmedSearch only.
        fStemmedSearch As Long
    '    BOOL fTitleOnly;         // TRUE for Title search only.
        fTitleOnly As Long
    '    BOOL fExecute;           // TRUE to initiate the search.
        fExecute As Long
    '    LPCTSTR pszWindow;       // Window to display in
        pszWindow As String
    '} HH_FTS_QUERY;
    End TypefrmMain.FRM:
    ==================================================
    Option ExplicitPrivate Sub Command1_Click()
        Dim h As Long
        Dim strTopic As String
        
        strTopic = "abort method"
        h = HTMLHELP(Me.hWnd, "C:\My Documents\BOOKS\xmlsdk25.chm", HH_DISPLAY_INDEX, strTopic)
        Debug.Print h
    End SubPrivate Sub Command2_Click()
        Dim h As Long
        
        h = HTMLHELP(Me.hWnd, "C:\My Documents\BOOKS\xmlsdk25.chm::/htm/xmmscxmldomenumeratedconstants.htm", HH_DISPLAY_TOPIC, vbNullString)
        Debug.Print h
    End SubPrivate Sub Command3_Click()
        Dim h As Long
        Dim qry As HH_FTS_QUERY
        
        qry.cbStruct = Len(qry)
        qry.fExecute = False
        qry.fStemmedSearch = False
        qry.fTitleOnly = False
        qry.fUniCodeStrings = False
        qry.iProximity = 0
        qry.pszSearchQuery = "XML AND XSL"
        qry.pszWindow = ""
        h = HTMLHELP(Me.hWnd, "C:\My Documents\BOOKS\xmlsdk25.chm", HH_DISPLAY_SEARCH, VarPtr(qry))
        Debug.Print h
    End Sub如果你需要其他常量或结构,你要安装 HtmlHelp Workshop,VB 6 安装盘上有;安装之后,在安装目录查找 HTMLHELP.H。自己写 C 到 VB 的转换吧,这也是我自己转换的。