FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Archivos de Ayuda CHM...
Posts: 476
Joined: Sat Feb 03, 2007 06:36 AM
Archivos de Ayuda CHM...
Posted: Mon Oct 12, 2009 11:27 PM

Hola a todos.
Alguien a implementado agregar la opcion de ayudas a sus sistemas, pero utilizando archivos .CHM?
Si pudieran darme un ejemplo, ya que no logro hacer funcionar en mi sistema que cuando presionen F1 se muestre la ayuda que esta definida con el HelpTopic del diaologo o de algun control.

Cualquier ayuda sera muy agradecida.

Saludos.

Carlos Sincuir

Posts: 111
Joined: Thu Jan 19, 2006 11:47 PM
Re: Archivos de Ayuda CHM...
Posted: Tue Oct 13, 2009 03:23 PM
Carlos:

Primero echate una pasada por este link:

http://www.mygnet.net/articulos/chm,help/568/

Esta parte del codigo lo saque si no mal recuerdo del foro en inglés, no me acuerdo en estos momentos quien es su autor...

Lo agregas como un .PRG adicional (AYUDA.PRG)

Code (fw): Select all Collapse
**Lo agrego para que no salga el mensaje de No existe ayuda cuando se oprime F1
**Solo Comentario de Mauricio Arevalo

//-----------------------------------------------------------------------//
// This functions provide a way to execute 32 Bits Help Files from a FiveWin Application
// under Windows NT.
// The problem is that FiveWin applications are recognized as 16 Bits applications by
// Windows NT, so NT thinks that help file is also 16 bits.
//-----------------------------------------------------------------------//
// Notes.
// Those functions will only work under 32 bits environment.
//-----------------------------------------------------------------------//

#include "FiveWin.ch"

//-----------------------------------------------------------------------//*

#define HELP_CONTEXT      1   // 0x0001
#define HELP_QUIT         2   // 0x0002
#define HELP_INDEX        3   // 0x0003
#define HELP_CONTENTS     3   // 0x0003
#define HELP_HELPONHELP   4   // 0x0004
#define HELP_SETINDEX     5   // 0x0005
#define HELP_SETCONTENTS  5   // 0x0005
#define HELP_CONTEXTPOPUP 8   // 0x0008
#define HELP_FORCEFILE    9   // 0x0009
#define HELP_KEY          257 // 0x0101
#define HELP_COMMAND      258 // 0x0102
#define HELP_PARTIALKEY   261 // 0x0105
#define HELP_MULTIKEY     513 // 0x0201
#define HELP_SETWINPOS    515 // 0x0203
#define HELP_FINDER       11 // 0x000b


//-----------------------------------------------------------------------//

function HelpTopic( nHelpId )

   local cHelpFile  := GetHelpFile()
   local cHelpTopic := GetHelpTopic()

* MSGSTOP(1)
   if Empty( cHelpFile )
*     MsgStop( "No Help file available", " Attention" )
      return .f.
   endif

   if nHelpId != NIL
      if ValType( nHelpId ) == "N"
         SPWinHelp( GetActiveWindow(), cHelpFile, HELP_CONTEXT, nHelpId )
      else
         SPWinHelpC( GetActiveWindow(), cHelpFile, HELP_KEY, nHelpId )
      endif
   else // nHelpId == NIL
      SPWinHelpC( GetActiveWindow(), cHelpFile, HELP_KEY, cHelpTopic )
   endif

return NIL

//-----------------------------------------------------------------------//


function HelpIndex()

   local cHelpFile  := GetHelpFile()
* MSGSTOP(2)
   if Empty( cHelpFile )
*     MsgStop( "No Help file available", " Attention" )
      return .f.
   endif

   SPWinHelp( GetActiveWindow(), cHelpFile, HELP_FINDER, 0 )

return NIL

//-----------------------------------------------------------------------//

function HelpSearch( cSearch )      // this is not working it just brings search screen

   local cHelpFile  := GetHelpFile()
* MSGSTOP(3)
   DEFAULT cSearch := ""

   if Empty( cHelpFile )
*     MsgStop( "No Help file available", " Attention" )
      return .f.
   endif

   SPWinHelpC( GetActiveWindow(), cHelpFile, HELP_PARTIALKEY, cSearch )

return NIL

//-----------------------------------------------------------------------//

function HelpPopup( nHelpId )

   local cHelpFile  := GetHelpFile()
* MSGSTOP(4)
   if Empty( cHelpFile )
*     MsgStop( "No Help file available", " Attention" )
      return .f.
   endif

   SPWinHelp( GetActiveWindow(), cHelpFile, HELP_CONTEXTPOPUP, nHelpId )

return NIL

//-----------------------------------------------------------------------//

function WinHelp( cHelpFile, nId, nParams )   // this don't work.

   DEFAULT nId     := HELP_CONTENTS
   DEFAULT nParams := 0
 MSGSTOP(5)
   SPWinHelp( GetActiveWindow(), cHelpFile, nId, nParams )

return NIL

//-----------------------------------------------------------------------//

DLL32 FUNCTION SPWinHelp( HWND AS LONG, cHelpFile AS LPSTR, nId AS LONG,;
     nParams AS LONG );
     AS BOOL PASCAL FROM "WinHelpA" LIB "User32.dll"

//-----------------------------------------------------------------------//

DLL32 FUNCTION SPWinHelpC( HWND AS LONG, cHelpFile AS LPSTR, nId AS LONG,;
     nParams AS LPSTR );
     AS BOOL PASCAL FROM "WinHelpA" LIB "User32.dll"

#ifndef __CLIPPER__
/*
DLL32 Function HTMLHelp( ;
   hWnd As LONG, cChmFile As LPSTR, nCommand As LONG, nTopic As LONG ) ;
   As LONG From "HtmlHelpA" Lib "hhctrl.ocx"
*/
DLL32 Function HTMLHelpCtx( ;
   hWnd As LONG, cChmFile As LPSTR, nCommand As LONG, cTopic As LPSTR ) ;
   As LONG From "HtmlHelpA" Lib "hhctrl.ocx"

DLL32 Function HTMLHelpPopup( ;
   hWnd As LONG, cChmFile As LPSTR, nCommand As LONG, @sPopUp As LPSTR ) ;
   As LONG From "HtmlHelpA" Lib "hhctrl.ocx"

#endif



En tu PRG principal agregas esta linea..
Code (fw): Select all Collapse
SetKey(VK_F1, {|nKey|HtmlHelp( 0, "\hym32\ayu\ayuda.chm", 2,0 ) })


Espero te sirva...Saludos
Edgar Mauricio Arévalo Mogollón.
Bogotá DC. Colombia
FWH FTDN, xHarbour 1.2.1, Pelles C, Fivedit, Visual Studio Code, Borland 7.30, Mysql, Dbfs
http://www.hymplus.com http://www.hymlyma.com
Tratando de retomar la programación....
Posts: 476
Joined: Sat Feb 03, 2007 06:36 AM
Re: Archivos de Ayuda CHM...
Posted: Tue Oct 13, 2009 09:11 PM

Gracias Mauro, con lo que me enviaste tengo para trabajar lo de la ayuda de mi sistema.

Saludos.

Carlos Sincuir

Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM
Re: Archivos de Ayuda CHM...
Posted: Tue Oct 13, 2009 10:22 PM

Hola Carlos

Sólo tenes que crear tu archivo de ayuda y lo activas en tu programa principal asi:

SetHelpFile("Ayuda.chm")

Saludos

Adhemar

Saludos,



Adhemar C.
Posts: 476
Joined: Sat Feb 03, 2007 06:36 AM
Re: Archivos de Ayuda CHM...
Posted: Wed Oct 14, 2009 01:10 PM

Gracias Adhemar, lo voy a tomar en cuenta.

Saludos.

Carlos Sincuir

Continue the discussion