打開幫助文檔CHM文件并且顯示關(guān)鍵詞 常見代碼編輯的F1鍵功能 - Function OpenHtmlHelp(hWndForm As HWnd,nFile As String,nKey As String ) As HWnd '
-
- Dim hh As Function (ByVal hwndCaller As HWnd , ByVal pszFile As LPCSTR , ByVal uCommand As UINT , ByVal dwData As DWORD_PTR) As HWnd
- Dim As Any Ptr library = Dylibload( "hhctrl.ocx" )
- hh = Dylibsymbol( library, "HtmlHelpA" )
- Dim szPath As String
- Dim szText As String
- Dim hlk(7) As ULong
- szPath=nFile & Chr(0) 'Help 文件名,,帶文件夾
- szText=nKey & Chr(0) '要查尋的關(guān)鍵詞
- ' hlk.cbStruct = Sizeof(hlk)
- ' hlk.pszKeywords = @szText
- ' hlk.fIndexOnFail = True
- hlk(0)=Sizeof(hlk)
- hlk(2)=Strptr(szText)
- hlk(7)=1
- hh( hWndForm, Strptr(szPath), 0, Null)'HH_DISPLAY_TOPIC
- Function=hh( hWndForm, Strptr(szPath), &H000D, @hlk(0))'HH_KEYWORD_LOOKUP
- Dylibfree( library )
- ' // Size = 32 bytes
- 'Type HH_AKLINK
- ' cbStruct As Long ' int cbStruct; // sizeof this structure
- ' fReserved As Long ' BOOL fReserved; // must be FALSE (really!)
- ' pszKeywords As ZString Ptr ' LPCTSTR pszKeywords; // semi-colon separated keywords
- ' pszUrl As ZString Ptr ' LPCTSTR pszUrl; // URL to jump to if no keywords found (may be NULL)
- ' pszMsgText As ZString Ptr ' LPCTSTR pszMsgText; // Message text to display in MessageBox if pszUrl is NULL and no keyword match
- ' pszMsgTitle As ZString Ptr ' LPCTSTR pszMsgTitle; // Message text to display in MessageBox if pszUrl is NULL and no keyword match
- ' pszWindow As ZString Ptr ' LPCTSTR pszWindow; // Window to display URL in
- ' fIndexOnFail As Long ' BOOL fIndexOnFail; // Displays index if keyword lookup fails.
- 'End Type
- End Function
用法舉例:OpenHtmlHelp "X:\Help\Win32SDK.CHM","abc"
|