HTMLHelp problem

User avatar
Dietmar Jahnel
Posts: 83
Joined: Mon Oct 17, 2005 10:33 am
Location: Austria
Contact:

Post by Dietmar Jahnel »

Antonio,
That does make sense!

But as soon as I copy the code to may sample below (which needs ridah.rc, I sent to you) it keeps GPF-ing (nice word) with this line in C-code, without its ok.

I cannot see a difference - so I hesitate do change our big application.
Sorry for coming back again ... but things like that can drive you crazy...

Code: Select all

#include "FiveWin.ch"
STATIC oWnd, sDlg, sDlg1
FUNCTION main()

REQUEST DBFCDX
RDDSETDEFAULT ( "DBFCDX" )

REQUEST HB_LANG_DE
HB_LANGSELECT( 'DE' )

vName = "32-bit test"

DEFINE WINDOW oWnd FROM 1, 1 TO 22, 75;
      TITLE vName ;
      MDI;
      MENU  BuildMenu();

ACTIVATE WINDOW oWnd MAXIMIZED;
      ON INIT SuchStart();
      VALID suchende()

RETURN nil



function BuildMenu()

   local oMenu

   MENU oMenu

    MENUITEM "&Datei"
      MENU
      MENUITEM "&Beenden";
          ACTION dlgEnd()
      ENDMENU

   ENDMENU

return oMenu


FUNCTION suchende

IF MsgYesNo( "RIDA beenden ?","" )
   RETURN .T.
ELSE
   RETURN .F.
ENDIF

RETURN .T.



FUNCTION dlgEnd()
oWnd:end()
RETURN




FUNCTION SuchStart()
  local hDLL := LoadLibrary( "hhctrl.ocx" )
  
  DEFINE WINDOW sDlg1 MDICHILD of oWnd;
         COLOR "N/W";
         TITLE "SUCHSCHIRM: " ;
         NOMINIMIZE;
         NOMAXIMIZE;
         NOSYSMENU

DEFINE DIALOG sDlg RESOURCE "Suchschirm2" of sDlg1;

//REDEFINE BUTTON ID 131 of sDlg;
//  ACTION dlgEnd ( )

REDEFINE BUTTON ID 122 of sDlg;
 ACTION (MsgInfo("open HTML-Help!"), HTMLHelp( 0, "fwclass.chm", 0, "class_todbc.htm" ))


ACTIVATE DIALOG sDlg NOWAIT;  // RESIZE16;
         ON INIT (sDlg:Move(0,0));

ACTIVATE WINDOW sDlg1;
         ON INIT (sDlg1:SetSize( sDlg:nWidth, sDlg:nHeight+40,.t.), sDlg1:Move(20,20,0,0,.t.));

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




User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Dietmar,

Place the LoadLibrary() call at function Main():

Code: Select all

FUNCTION main()

  local hDLL := LoadLibrary( "hhctrl.ocx" ) 
...
and remove it from function SuchStart(). Also move the FreeLibrary( hDLL ) call to the end of function Main().

Your problem is caused as the MDICHILD window is MODELESS (it does not wait) so FreeLibrary() gets inmediately called
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Dietmar Jahnel
Posts: 83
Joined: Mon Oct 17, 2005 10:33 am
Location: Austria
Contact:

Post by Dietmar Jahnel »

Antonio,

Thanks a lot - now it's working even in our bit application!
Now we can migrate to chm! :D

... those little things.

Regards,
Dietmar
Post Reply