The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Wx::ActiveX - ActiveX Control Interface for Wx

VERSION

Version 0.16

SYNOPSIS

    use Wx::ActiveX qw( EVT_ACTIVEX );
    use Wx qw( wxID_ANY wxDefaultPosition , wxDefaultSize );
   
    ........

    my $activex = Wx::ActiveX->new(
                  $parent,
                  "WMPlayer.OCX",
                  wxID_ANY,
                  wxDefaultPosition,
                  wxDefaultSize );
                  
    EVT_ACTIVEX( $this, $activex, "PlaylistCollectionChange", \&on_event_handler );
    
    $activex->PropSet("URL",'pathtomyfile.avi') ;
    
    ..........
    
    $activex->Invoke("launchURL", "http://my.url.com/file.movie") ;

    ... or ...

    $activex->launchURL("http://my.url.com/file.movie") ;
    
    ----------------------------------------------------------------
    
    package MyActiveXControl;
    use Wx::ActiveX;
    use base qw( Wx::ActiveX );
    
    our (@EXPORT_OK, %EXPORT_TAGS);
    $EXPORT_TAGS{everything} = \@EXPORT_OK;
    
    my @activexevents = qw(
        OnReadyStateChange
        FSCommand
        OnProgress
    );
    
    my $exporttag = 'elviscontrol';
    my $eventname = 'ELVIS'; 
    
    __PACKAGE__->activex_load_activex_event_types( __PACKAGE__,
                                                  $eventname,
                                                  $exporttag,
                                                  \@activexevents );
    
    ...
    
    EVT_ACTIVEX_ELVIS_ONPROGRESS( $this, $activex,\&on_event_handler );
    
    

DESCRIPTION

Load ActiveX controls for wxWindows. The package installs a module in Wx::Demo for reference.

There are some wrapped controls included with the package:

    Wx::ActiveX::IE                  Internet Explorer Control
    Wx::ActiveX::Mozilla             Mozilla Browser Control
    Wx::ActiveX::WMPlayer            Windows Media Player
    Wx::ActiveX::ScriptControl       MS Script Control
    Wx::ActiveX::Document            Control Wrapper via Browser
    Wx::ActiveX::Acrobat             Acrobat ActiveX Control
    Wx::ActiveX::Flash               Adobe Flash Control
    Wx::ActiveX::Quicktime           Apple QuickTime ActiveX Control

See the POD for each indvidual control.

There is also a Template producer that will provide code for a module given an ActiveX ProgID.

wxactivex_template

or

perl -MWx::ActiveX::Template -e"run_wxactivex_template();"

METHODS

new ( PARENT , CONTROL_ID , ID , POS , SIZE )

Create the ActiveX control.

  PARENT        need to be a Wx::Window object.
  CONTROL_ID    The control ID (PROGID/string).
PropVal ( PROP_NAME )

Get the value of a propriety of the control.

PropSet ( PROP_NAME , VALUE )

Set a propriety of the control.

  PROP_NAME  The propriety name.
  VALUE      The value(s).
PropType ( PROP_NAME )

Return the type of the propriety.

GetEventCount

Returnt the number of events that the control have.

GetPropCount

Returnt the number of proprieties.

GetMethodCount

Returnt the number of control methods.

GetEventName( X )

Returnt the name of the event X, where X is a integer.

GetPropName( X )

Returnt the name of the propriety X, where X is a integer.

GetMethodName( X )

Returnt the name of the method X, where X is a integer.

GetMethodArgCount( MethodX )

Returnt the number of arguments of the MethodX.

GetMethodArgName( MethodX , ArgX )

Returnt the name of the ArgX of MethodX.

ListEvents()

Return an ARRAY with all the events names.

ListProps()

Return an ARRAY with all the proprieties names.

ListMethods()

Return an ARRAY with all the methods names.

ListMethods_and_Args()

Return an ARRAY with all the methods names and arguments. like:

  foo(argx, argy)
ListMethods_and_Args_Hash()

Return a HASH with all the methods names (keys) and arguments (values). The arguments are inside a ARRAY ref:

  my %methods = $activex->ListMethods_and_Args_Hash ;
  my @args = @{ $methods{foo} } ;
ActivexInfos()

Return a string with all the informations about the ActiveX Control:

  <EVENTS>
    MouseUp
    MouseMove
    MouseDown
  </EVENTS>
  
  <PROPS>
    FileName
  </PROPS>
  
  <METHODS>
    Close()
    Load(file)
  </METHODS>

Win32::OLE

From version 0.5 Wx::ActiveX is compatible with Win32::OLE objects:

  use Wx::ActiveX ;
  use Win32::OLE ;
  
  my $activex = Wx::ActiveX->new( $this , "ShockwaveFlash.ShockwaveFlash" , 101 , wxDefaultPosition , wxDefaultSize ) ;

  my $OLE = $activex->GetOLE() ;
  $OLE->LoadMovie('0' , "file:///F:/swf/test.swf") ;
  $OLE->Play() ;

EVENTS

All the events use EVT_ACTIVEX.

  EVT_ACTIVEX($parent , $activex , "EventName" , sub{...} ) ;
  

** You can get the list of ActiveX event names using ListEvents():

Each ActiveX event has its own argument list (hash), and the method 'Veto' can be used to ignore the event. In this example any new window will be canceled, seting $evt->IsAllowed to False:

  EVT_ACTIVEX($this,$activex, "EventX" , sub{
    my ( $obj , $evt ) = @_ ;
    $evt->Veto;
  }) ;

SEE ALSO

Wx::ActiveX::IE, Wx::ActiveX::Mozilla, Wx::ActiveX::WMPlayer, Wx

AUTHORS & ACKNOWLEDGEMENTS

Wx::ActiveX has benefited from many contributors:

Graciliano Monteiro Passos - original author

Contributions from:

Simon Flack Mattia Barbon Eric Wilhelm Andy Levine Mark Dootson

Thanks to Justin Bradford and Lindsay Mathieson who wrote the C classes for wxActiveX and wxIEHtmlWin.

COPYRIGHT & LICENSE

Copyright (C) 2002-2011 Authors & Contributors, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

CURRENT MAINTAINER

Mark Dootson <mdootson@cpan.org>