use strict;
use Win32::GUI;

use Win32::OLE ();
use Win32::OLE::Const ();
use Cwd;

#Get the current working dir
my $cwd = cwd();

#Define the same contants that are used in the help system
sub IDH_Page1() {1003};
sub IDH_Page2() {1004};
sub IDH_Page3() {1005};
sub IDH_Page4() {1006};

# Create the main window
my $mainwindow = new Win32::GUI::Window(
    -name   => "Window",                    
    -title  => "HTML help example",           
    -pos    => [100,100],                  
    -size   => [400,400],
);

  $mainwindow->AddButton (
    -name   => 'Help',
    -text   => 'Help',
    -height => 20,
    -width  => 60,
    -top    => 2,
    -left   => 60,  
    -tip    => 'Help page 1',
    -onClick => sub {ShowHelp(IDH_Page1)},
); 

  $mainwindow->AddButton (
    -name   => 'Help2',
    -text   => 'Help 2',
    -height => 20,
    -width  => 60,
    -top    => 24,
    -left   => 60,  
    -tip    => 'Help page 2',
    -onClick => sub {ShowHelp(IDH_Page2)},
);

$mainwindow->Show();

#Enter the message processing loop
Win32::GUI::Dialog();

sub ShowHelp {
  #show the help for this ID
  my $id=shift;
  Win32::OLE::Const::_ShowHelpContext("$cwd/Help.chm",$id);
  return 1;
}
