HTMLHelp problem
- Dietmar Jahnel
- Posts: 83
- Joined: Mon Oct 17, 2005 10:33 am
- Location: Austria
- Contact:
HTMLHelp problem
I still get an GPF when I try the following (FWH 7.01):
MENUITEM ....
ACTION HTMLHelp( 0, "RIDA.CHM", 15, IDH_DATEN)
Any solution for Vista-PCs?
Dietmar
MENUITEM ....
ACTION HTMLHelp( 0, "RIDA.CHM", 15, IDH_DATEN)
Any solution for Vista-PCs?
Dietmar
- Dietmar Jahnel
- Posts: 83
- Joined: Mon Oct 17, 2005 10:33 am
- Location: Austria
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Dietmar,
The problem is related to "hhctrl.ocx" itself. We have tested it this way to avoid a possible error from DLL FUNCTION command, and it keeps GPFing:
The problem is related to "hhctrl.ocx" itself. We have tested it this way to avoid a possible error from DLL FUNCTION command, and it keeps GPFing:
Code: Select all
#include "FiveWin.ch"
function Main()
local oWnd
DEFINE WINDOW oWnd TITLE "Test"
@ 2, 2 BUTTON "Help" SIZE 80, 20 ACTION HTMLHelp( 0, "fwclass.chm", 2, 1 )
ACTIVATE WINDOW oWnd
return nil
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
typedef LONG ( * PHTMLHELP ) ( HWND, LPSTR, LONG, LONG );
HB_FUNC( HTMLHELP )
{
HINSTANCE hDLL = LoadLibrary( "hhctrl.ocx" );
PHTMLHELP pHTMLHelp = ( PHTMLHELP ) GetProcAddress( hDLL, "HtmlHelpA" );
pHTMLHelp( ( HWND ) hb_parnl( 1 ), hb_parc( 2 ), hb_parnl( 3 ), hb_parnl( 4 ) );
FreeLibrary( hDLL );
}
#pragma ENDDUMP
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Maybe the GPF is coming from here:
Some samples:Declare Function HtmlHelp Lib "HHCtrl.ocx" Alias "HtmlHelpA" _
(ByVal hwndCaller As Long, _
ByVal pszFile As String, _
ByVal uCommand As Long, _
dwData As Any) As Long
...
dwData Specifies additional data depending on the value of uCommand. Note that in this declaration this argument is declared As Any, because this argument accepts several different data types. You must be careful to pass the correct data type or risk an invalid page fault (also known as general protection fault [GPF]).
Call HtmlHelp(0, "c:\help\Sample.chm", HH_DISPLAY_TOPIC, By Val "Topic1.htm")
Call HtmlHelp(0, "c:\help\Sample.chm>mso_small", HH_DISPLAY_TOPIC, By Val 2001&)
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
SOLVED! No GPFs!
Effectively the key is to use the right parameters and also a PASCAL declaration was missing:
Effectively the key is to use the right parameters and also a PASCAL declaration was missing:
Code: Select all
#include "FiveWin.ch"
function Main()
local oWnd
DEFINE WINDOW oWnd TITLE "Test"
@ 2, 2 BUTTON "Help" SIZE 80, 20 ACTION HTMLHelp( 0, "fwclass.chm", 0, "class_todbc.htm" )
ACTIVATE WINDOW oWnd
return nil
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
typedef LONG PASCAL ( * PHTMLHELP ) ( HWND, LPSTR, LONG, LPSTR );
HB_FUNC( HTMLHELP )
{
HINSTANCE hDLL = LoadLibrary( "hhctrl.ocx" );
PHTMLHELP pHTMLHelp = ( PHTMLHELP ) GetProcAddress( hDLL, "HtmlHelpA" );
pHTMLHelp( ( HWND ) hb_parnl( 1 ), hb_parc( 2 ), hb_parnl( 3 ), hb_parc( 4 ) );
FreeLibrary( hDLL );
}
#pragma ENDDUMP
- Dietmar Jahnel
- Posts: 83
- Joined: Mon Oct 17, 2005 10:33 am
- Location: Austria
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Dietmar Jahnel
- Posts: 83
- Joined: Mon Oct 17, 2005 10:33 am
- Location: Austria
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Ok, I found the solution We can not free the DLL just after its use.
Here is a working sample using a dialog box and its working fine:
Here is a working sample using a dialog box and its working fine:
Code: Select all
#include "FiveWin.ch"
function Main()
local oDlg
local hDLL := LoadLibrary( "hhctrl.ocx" );
DEFINE DIALOG oDlg TITLE "Test"
@ 2, 2 BUTTON "Help" SIZE 60, 15 ACTION HTMLHelp( oDlg:hWnd, "fwclass.chm", 0, "class_tget.htm" )
ACTIVATE DIALOG oDlg CENTERED
FreeLibrary( hDLL )
return nil
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
typedef LONG PASCAL ( * PHTMLHELP ) ( HWND, LPSTR, LONG, LPSTR );
HB_FUNC( HTMLHELP )
{
HINSTANCE hDLL = LoadLibrary( "hhctrl.ocx" );
PHTMLHELP pHTMLHelp = ( PHTMLHELP ) GetProcAddress( hDLL, "HtmlHelpA" );
if( pHTMLHelp )
pHTMLHelp( ( HWND ) hb_parnl( 1 ), hb_parc( 2 ), hb_parnl( 3 ), hb_parc( 4 ) );
FreeLibrary( hDLL );
}
#pragma ENDDUMP
- Dietmar Jahnel
- Posts: 83
- Joined: Mon Oct 17, 2005 10:33 am
- Location: Austria
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Dietmar Jahnel
- Posts: 83
- Joined: Mon Oct 17, 2005 10:33 am
- Location: Austria
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Dietmar,
No, here we keep the FreeLibrary() call into the C function, so it matches the previous LoadLibrary().
You need to keep a call to LoadLibrary() from the PRG. Do it as the beginning of your application and free it when you are going to exit from your application.
Keep it mind that you can NOT call FreeLibrary() meanwhile the help is shown, or you will have a GPF.
No, here we keep the FreeLibrary() call into the C function, so it matches the previous LoadLibrary().
You need to keep a call to LoadLibrary() from the PRG. Do it as the beginning of your application and free it when you are going to exit from your application.
Keep it mind that you can NOT call FreeLibrary() meanwhile the help is shown, or you will have a GPF.