The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Win32::GUI::AxWindow - Perl extension for Hosting ActiveX Control in Win32::GUI

SYNOPSIS

use Win32::GUI;
use Win32::GUI::AxWindow;

# Main Window
$Window = new Win32::GUI::Window (
             -name     => "Window",
             -title    => "Win32::GUI::AxWindow test",
             -post     => [100, 100],
             -size     => [400, 400],
);

# Add a WebBrowser AxtiveX
$Control = new Win32::GUI::AxWindow  (
              -parent  => $Window,
              -name    => "Control",
              -control => "Shell.Explorer.2",
              # -control => "{8856F961-340A-11D0-A96B-00C04FD705A2}",
              -pos     => [0, 0],
              -size    => [400, 400],
);

# Register some event
$Control->RegisterEvent("StatusTextChange",
                         sub {
                             $self    = shift;
                             $eventid = shift;
                             print "Event : ", @_, "\n";
                          } );

# Call Method
$Control->CallMethod("Navigate", 'http://www.perl.com/');

# Event loop
$Window->Show();
Win32::GUI::Dialog();

# Main window event handler

sub Window_Terminate {

  return -1;
}

sub Window_Resize {

  if (defined $Window) {
    ($width, $height) = ($Window->GetClientRect)[2..3];
    $Control->Move   (0, 0);
    $Control->Resize ($width, $height);
  }
}

DESCRIPTION

AxWindow

new (...)
Create a new ActiveX window.

options  :

-parent  => parent window  (Required)
-name    => window name    (Required)
-size    => window size [ width, heigth ]
-pos     => window pos  [ left, top ]
-width   => window width
-height  => window height
-left    => window left
-top     => window top
-control => clisd (see below) (Required).

clsid is a string identifier to create the control.
Must be formatted in one of the following ways:

  - A ProgID such as "MSCAL.Calendar.7"
  - A CLSID such as "{8E27C92B-1264-101C-8A2F-040224009C02}"
  - A URL such as "http://www.microsoft.com"
  - A reference to an Active document such as 'file://Documents/MyDoc.doc'
  - A fragment of HTML such as "MSHTML:<HTML><BODY>This is a line of text</BODY></HTML>"
    Note   "MSHTML:" must precede the HTML fragment so that it is designated as being an MSHTML stream.

styles:

-visible => 0/1
-tabstop => 0/1
-hscroll => 0/1
-vscroll => 0/1

-style, -addstyle, -pushstyle, -remstyle, -popstyle
-exstyle, -exaddstyle, -expushstyle, -exremstyle, -expopstyle

Default style is : WS_CHILD |  WS_VISIBLE | WS_TABSTOP | WS_CLIPCHILDREN
Release ()
If have crash when exiting, call this function before all the window are destroy (before Win32::GUI::Dialog(); exit).
Generaly, call this function in the Window_Terminate handle.

Property

EnumPropertyID ()
Return a list of all the Property ID of the control.
EnumPropertyName ()
Return a list of all the Property name of the control.
GetPropertyInfo (ID_or_Name)
Return a hash with information about the Property from ID or Name.

Hash entry :
  -Name        => Property Name.
  -ID          => Property ID.
  -VarType     => Property Type (Variant type).
  -EnumValue   => A formated string of enum value ( enum1=value1,enum2=value2,... ).
  -ReadOnly    => Indicate if a property can only be read.
  -Description => Property Description.
  -Prototype   => Prototype
GetProperty (ID_or_Name, [index, ...])
Get property value.
For indexed property, add index list.
SetProperty (ID_or_Name, [index, ...], value)
Set property value
For indexed property, add index list before value.

Method

EnumMethodID ()
Return a list of all the Method ID of the control.
EnumMethodName ()
Return a list of all the Method name of the control.
GetMethodInfo (ID_Name)
Return a hash with information about the Method from ID or Name.

Hash entry :
  -Name        => Method Name.
  -ID          => Method ID.
  -Description => Method Description.
  -Prototype   => Method Prototype.
CallMethod (ID_or_Name, ...)
Invoke a method of an ActiveX control.

Event

EnumEventID ()
Return a list of all the Event ID of the control.
EnumEventName ()
Return a list of all the Event Name of the control.
GetEventInfo (ID_or_Name)
Return a hash with information about the Event from ID or Name.

Hash entry :
  -Name        => Method Name.
  -ID          => Method ID.
  -Description => Method Description.
  -Prototype   => Method Prototype.
RegisterEvent (ID_or_Name, Callback)
Associate a Callback for an ActiveX Event.

Win32::OLE

GetOLE ()
Return a Win32::OLE object of Hosted ActiveX Control.

You MUST add use Win32::OLE in your script.

AUTHOR

Laurent Rocher (lrocher@cpan.org)
HomePage :http://perso.club-internet.fr/rocherl/Win32GUI.html

SEE ALSO

Win32::GUI

10 POD Errors

The following errors were encountered while parsing the POD:

Around line 211:

'=item' outside of any '=over'

Around line 254:

You forgot a '=back' before '=head2'

Around line 256:

'=item' outside of any '=over'

Around line 287:

You forgot a '=back' before '=head2'

Around line 289:

'=item' outside of any '=over'

Around line 311:

You forgot a '=back' before '=head2'

Around line 313:

'=item' outside of any '=over'

Around line 335:

You forgot a '=back' before '=head2'

Around line 337:

'=item' outside of any '=over'

Around line 343:

You forgot a '=back' before '=head1'