This is my response to a query on perlmonks. It loads the default Adobe Acrobat ActiveX viewer in a Win32::GUI window via a file open menu. I used the Notepad.pl and GetOpenFileName.pl files for my base app.
#!perl -w use strict; use warnings; use Win32::GUI 1.06 qw(CW_USEDEFAULT); use Win32::GUI::AxWindow; # Define the application menu my @menu_defn = ( "File" => "File", ">OpenPDf" => { -name => "OpenPDF", -onClick => \&OpenPDF}, ">Exit" => { -name => "Exit", -onClick => \&QuitFile }, ); my $menu = Win32::GUI::Menu->new(@menu_defn); #Define the application window my $mw = Win32::GUI::Window->new( -title => "Open PDF File", -size => [400,400], -left => CW_USEDEFAULT, -menu => $menu, -onResize => \&resize, -onTerminate => \&QuitFile, ); # Add a Acrobat AxtiveX control my $PDFControl = new Win32::GUI::AxWindow ( -parent => $mw, -name => "PDFControl", -control => "AcroPDF.PDF.1", -pos => [0, 0], -size => [400, 400], ); #Show application window $mw->Show(); #Enter event loop Win32::GUI::Dialog(); #Hide windows on exit $mw->Hide(); undef $mw; exit(0); #Open standard windows file open dialog box sub OpenPDF { my ( @file, $file ); my ( @parms ); push @parms, -filter => [ 'PDF - Adobe Acrobat File', '*.pdf', ], -directory => "c:\\", -title => 'Select a PDF file'; @file = Win32::GUI::GetOpenFileName ( @parms ); # print "PDF File: $file[ 0 ]\n"; # Call Acorbat LoadFile Method $PDFControl->CallMethod("LoadFile", $file[ 0 ]); return 0; } #resize to fit user input sub resize { my ($self) = @_; my ($width, $height) = ($self->GetClientRect())[2..3]; $self->PDFControl->Resize($width+1, $height+1) if exists $self->{PDFControl}; } #Exit the application sub QuitFile { my $self = shift; #Set the Acrobat control to nothing $PDFControl->CallMethod("LoadFile", ""); #This line is needed to keep the PERL interperter from crashing $PDFControl->Release(); return -1; } -- View this message in context: http://www.nabble.com/Sample-Application-to-load-Adobe-Acrobat-ActiveX-control-tp18294501p18294501.html Sent from the perl-win32-gui-users mailing list archive at Nabble.com. ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/