Hi,

I am trying to pass a win32:OLE application handle to another thread but the memory location printed is incorrect. I have tried various methods such as using shared module and getactiveobject method but nothing worked. Any help is greatly appreciated. Please see the code below:

use Win32::OLE; use Win32::OLE::Variant; use Win32::OLE qw(EVENTS); #reuired to capture the events use Thread qw(:DEFAULT async yield); my $RQCC = Win32::OLE->new("Excel.Application") || die "CreateObject: +$!"; print "MainProcess = $RQCC\n"; # Starting to monitor event queue my $EventQueueTread = Thread->new(\&MonitorEventQueue); system "pause"; return 1; sub MonitorEventQueue { my $Devicehandle=Win32::OLE->GetActiveObject('Excel.Application'); print "MonitorEventQueue = $Devicehandle\n"; system "pause"; }

I have the following PERL installed on my systems:
This is perl, v5.10.1 built for MSWin32-x86-multi-thread (with 4 registered patches, see perl -V for more detail)

Copyright 1987-2009, Larry Wall

Binary build 1008 294165 provided by ActiveState http://www.ActiveState.com Built Dec 9 2010 06:00:35


In reply to Passing win32::0LE object handle to another thread by himanshujain_60

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.