Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Using IE to render html

by alien_life_form (Pilgrim)
on May 08, 2002 at 13:46 UTC ( #165028=snippet: print w/ replies, xml ) Need Help??

Description: On Win32, the omni-{present,vorous} explorer control is a convenient way to render html on the fly. This is easy if you write it to a file - however doing it directly from a string requires some non-obvious component manipulation...
use Win32::OLE;
# standard IE manipulation
my $ie=Win32::OLE->new('InternetExplorer.Application');
die('Creating explorer window: ' . Win32::OLE->LastError())
  unless $ie;
# make visible
$ie->{Visible}=1;
# hide a  lot of UI stuff
$ie->{AddressBar} =  $ie->{ToolBar} =  
                     $ie->{StatusBar} = $ie->{MenuBar} = 0;
# force the creation  of the document object
$ie->Navigate2('about:');
# this is not directly creatable.
my $doc=$ie->document();
die('Creating explorer document: ' . 
       Win32::OLE->LastError()) unless $doc;
$doc->write('<html><head></head><body><h1>Cool</h1></body></html>');
sleep(1) while $ie->{Busy};
# if jscript is involved...
#$ie->Refresh(); # Shows jscript but crashes ie...why?
#...carry on...

Comment on Using IE to render html
Download Code

Back to Snippets Section

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: snippet [id://165028]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2014-12-19 23:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (94 votes), past polls