*&-Begin---------------------------------------------------------------*
*&
*& Program  Z_CLASSTEST
*&
*&---------------------------------------------------------------------*

REPORT  Z_CLASSTEST.

INCLUDE OLE2INCL.

*----------------------------------------------------------------------*
*       CLASS cLocalHelp DEFINITION
*----------------------------------------------------------------------*
CLASS cLocalHelp DEFINITION.

  PUBLIC SECTION.
    "-Methods-----------------------------------------------------------
    METHODS Constructor.
    METHODS Destructor_.
    METHODS Open IMPORTING FileName TYPE c.
    METHODS ShowTOC IMPORTING FileName TYPE c.
    METHODS ShowIndex IMPORTING FileName TYPE c.
    METHODS ShowTopic IMPORTING FileName TYPE c Topic TYPE c.
    METHODS CloseAll.
    "-Variables---------------------------------------------------------
    DATA hOpen TYPE i.

  PRIVATE SECTION.
    "-Constants---------------------------------------------------------
    DATA HH_DISPLAY_TOPIC TYPE i VALUE 0.
    DATA HH_DISPLAY_TOC TYPE i Value 1.
    DATA HH_DISPLAY_INDEX TYPE i VALUE 2.
    DATA HH_DISPLAY_SEARCH TYPE i VALUE 3.
    DATA HH_CLOSE_ALL TYPE i VALUE 18.
    "-Variables---------------------------------------------------------
    DATA Help TYPE OLE2_OBJECT.

ENDCLASS.                    "cLocalHelp DEFINITION

*----------------------------------------------------------------------*
*       CLASS cLocalHelp IMPLEMENTATION
*----------------------------------------------------------------------*
CLASS cLocalHelp IMPLEMENTATION.

  METHOD Constructor.
    CREATE OBJECT Help 'DynamicWrapperX'.
    "-Register method for HTML help-------------------------------------
    CALL METHOD OF Help 'Register' EXPORTING #1 = 'hhctrl.ocx'
      #2 = 'HtmlHelpA' #3 = 'i=hsll' #4 = 'r=l'.
  ENDMETHOD.                    "Constructor

  METHOD Destructor_.
    FREE OBJECT Help.
  ENDMETHOD.                    "Destructor

  METHOD Open.
    CALL METHOD OF Help 'HtmlHelpA' = hOpen EXPORTING #1 = 0
      #2 = FileName #3 = HH_DISPLAY_TOPIC #4 = 0.
  ENDMETHOD.                    "Open

  METHOD ShowTOC.
    CALL METHOD OF Help 'HtmlHelpA' EXPORTING #1 = 0 #2 = FileName
      #3 = HH_DISPLAY_TOC #4 = 0.
  ENDMETHOD.                    "ShowToc

  METHOD ShowIndex.
    CALL METHOD OF Help 'HtmlHelpA' EXPORTING #1 = 0 #2 = FileName
      #3 = HH_DISPLAY_INDEX #4 = 0.
  ENDMETHOD.                    "ShowIndex

  METHOD ShowTopic.
    DATA ptr TYPE i.
    CALL METHOD OF Help 'StrPtr' = ptr EXPORTING #1 = Topic
        #2 = 'z'.
    CALL FUNCTION 'FLUSH'.
    CALL METHOD OF Help 'HtmlHelpA' EXPORTING #1 = 0 #2 = FileName
      #3 = HH_DISPLAY_TOPIC #4 = ptr.
  ENDMETHOD.                    "ShowTopic

  METHOD CloseAll.
    CALL METHOD OF Help 'HtmlHelpA' EXPORTING #1 = 0 #2 = ''
      #3 = HH_CLOSE_ALL #4 = 0.
  ENDMETHOD.                    "CloseAll

ENDCLASS.                    "cLocalHelp IMPLEMENTATION

"-Main------------------------------------------------------------------

TYPES LocalHelp TYPE REF TO cLocalHelp.
DATA HelpFile(255) TYPE c VALUE 'c:\windows\help\wmplayer.chm'.
DATA WMPlayerHelp TYPE LocalHelp.

START-OF-SELECTION.
  CREATE OBJECT WMPlayerHelp.
  CALL METHOD WMPlayerHelp->Open EXPORTING FileName = HelpFile.
  CALL METHOD WMPlayerHelp->ShowIndex EXPORTING FileName = HelpFile.
  CALL METHOD WMPlayerHelp->ShowTOC EXPORTING FileName = HelpFile.
  CALL METHOD WMPlayerHelp->ShowTopic EXPORTING FileName = HelpFile
      Topic = 'htm/toresizethevideowindow.htm'.
  CALL METHOD WMPlayerHelp->CloseAll.
  CALL METHOD WMPlayerHelp->Destructor_.
END-OF-SELECTION.

"-End-------------------------------------------------------------------