Site Navigation

User Guide

Reference

Packages

 

SYNOPSIS

  use Win32::GUI();
  use Win32::GUI::AxWindow;
  # Main Window
  $Window = new Win32::GUI::Window(
      -name  => "Window",
      -title => "Win32::GUI::AxWindow test",
      -pos   => [100, 100],
      -size  => [400, 400],
  );
  # Add a WebBrowser AxtiveX
  $Control = new Win32::GUI::AxWindow (
      -parent   => $Window,
      -name     => "Control",
      -control  => "Shell.Explorer",
      -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_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 that "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 you have a crash when exiting, call this function before all the windows are destroyed (i.e. before Win32::GUI::Dialog(); exits). Generaly, call this function in the Window_Terminate event handler.

Property

EnumPropertyID ()

Return a list of all the Property IDs of the control.

EnumPropertyName ()

Return a list of all the Property names 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 IDs of the control.

EnumMethodName ()

Return a list of all the Method names 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 IDs of the control.

EnumEventName ()

Return a list of all the Event Names 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)

DEPENDENCIES

This module requires these other modules and libraries:

Win32::GUI
Active Template Library (ATL)

COPYRIGHT AND LICENCE

Copyright 2003 by Laurent Rocher (lrocher@cpan.org)

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

See http://www.perl.com/perl/misc/Artistic.html