|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to open a chm file nicely ?When I open a chm file from an MDI form using the command like in sample-1 below, the fle always appears on top of the form. Is there any other way so that when I switch to the form, the chm file automatically goes backward ? I have tried the sample-2 below. It can open the file as expected. But it can not work if no child form opened. Could you help me ? Thanks in advance John S. '----Sample-1----- Const HH_DISPLAY_TOPIC = &H0 Private 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 Private Sub mhelp_Click(Index As Integer) If Index = 1 then Dim hwndHelp As Long hwndHelp = HtmlHelp(hwnd, App.Path & "\h.chm", HH_DISPLAY_TOPIC, 0) End If End Sub '----Sample-2----- Private Sub MDIForm_Load() App.HelpFile = App.Path & "\h.chm" End Sub Private Sub mhelp_Click(Index As Integer) If Index = 1 then SendKeys "{F1}" End If End Sub *** Sent via Developersdex http://www.developersdex.com *** "John S" <nospam> wrote in message John,news:O8piFtQRGHA.336@TK2MSFTNGP12.phx.gbl... > Hi All, > > When I open a chm file from an MDI form using > the command like in sample-1 below, > the fle always appears on top of the form. > Is there any other way so that when I switch to > the form, the chm file automatically goes backward ? > see inline <snip> ' don't forget this at the top of your module Option Explicit > '----Sample-1----- ' without defining hwnd your code won't run> Const HH_DISPLAY_TOPIC = &H0 > Private 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 > > Private Sub mhelp_Click(Index As Integer) dim hwnd as long ' set it to the form's window handle or you will attach to the desktop hwnd = Me.hWnd > If Index = 1 then bye,> Dim hwndHelp As Long > hwndHelp = HtmlHelp(hwnd, App.Path & "\h.chm", HH_DISPLAY_TOPIC, 0) > End If > End Sub > > tlviewer Hi tlviewer
I solved my problem with setting hwnd = GetDesktopWindow() before hwndhelp = .... Thank you for your help *** Sent via Developersdex http://www.developersdex.com ***
Why ?? (Path/File access error (Error 75)
VB.NET or C++.NET or C# Password Change Using the replace command, please help NTFS File Access in VB6 Sub or Function is not defined Testing for "Access Denied" without trying to change the file Control similar to MS Access List Box write to disk and permissions Cross-posting - How To? |
|||||||||||||||||||||||