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

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);
}
}

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.
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.
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.
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.
GetOLE ()Return a Win32::OLE object of Hosted ActiveX Control. You MUST add use Win32::OLE in your script.

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

Win32::GUI