I don't fully grasp why your code fails. I think as fork is emulated by threading, both child and parent attempt to hang on to the same object, and free it when they are finished, so the problems start as soon as one of them (the child) exits. Yet the child makes no use of the OLE object, so it really is a pity. Ideally, you ought to be able to relinquish the OLE object without actually freeing it.

If this is about all that your child does, perhaps you should think of using Win32::Process to run the child with the messagebox in a completely independent process. You can use They didn't give me a fork so I have to eat with a spawn. as sample code for the setup.

You may have to add extra code to resynchronize parent and child after both have finished with their respective tasks, but there's a lot of methods available in Win32::Process to that effect for use in the parent, most notably Wait; so the parent will not go on beyond your loop before the button on the messagebox is pushed.


In reply to Re: Fork in Win32 environment by bart
in thread Fork in Win32 environment by esr

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.