FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour HTMLHelp problem
Posts: 83
Joined: Mon Oct 17, 2005 10:33 AM
HTMLHelp problem
Posted: Sat Aug 11, 2007 01:00 PM
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...

#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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
HTMLHelp problem
Posted: Sat Aug 11, 2007 01:46 PM
Dietmar,

Place the LoadLibrary() call at function Main():
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
Posts: 83
Joined: Mon Oct 17, 2005 10:33 AM
HTMLHelp problem
Posted: Sat Aug 11, 2007 03:17 PM

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

Continue the discussion