Re: Problems with VB6 activex in PowerPoint



Thanks for your reply .. unfortunately it doesn't work in my situation. If
the recursion were being generated by my VB code, this would work ... but in
this particular case, the recursion (if indeed that's what's going on) is
happening between PowerPoint and VB. Normally I don't handle the Resize
event at all ... I just added some output of the width and height to see
what was happening under the failure condition. A normal resize (when
things are working right) generates only one resize event. After having
displayed the custom prop*** via 'mycontrol Object | Properties' an
attempt to resize generated almost 150 calls to Resize, with the size
shrinking slightly on each call until the control becomes square and
medium-sized (6570 x 6570). I get 1-2 seconds of hourglass cursor while
this is happening. On my particular machine and PowerPoint version, it
doesn't crash, but on other PowerPoint versions it crashes PowerPoint. This
sounds like the same error condition described in KB314441, but from a
different cause.

At this point, my only hope is to find a way to prevent a user from invoking
the custom prop*** in that manner ... when it is called from the normal
property browser's 'Custom' button, everything works fine. If I can't find
a way to disable the 'Mycontrol Object | Properties' menu item, it looks
like I'll be recoding the OCX in VC++ ...


"Ken Halter" <Ken_Halter@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:#TRUap7hFHA.3568@xxxxxxxxxxxxxxxxxxxxxxx
> "Jerry" <jvelders@xxxxxxxxxxxxxx> wrote in message
> news:11da877hutob04@xxxxxxxxxxxxxxxxxxxxx
> >
> > As an addendum, I should note that I've read KB314441, and while the
> > problem
> > is very similar, I do NOT have EditAtDesignTime enabled. Also, I placed
a
> > couple of lines of code in the resize event to log the control's height
> > and
> > width, and when it fails, it generates over 140 calls to resize,
> > renegotiating the size downward until it either crashes or reaches an
> > 'acceptable' size .. Presumably this renegotiation is recursive, and
> > causes
> > an out-of-memory condition.
>
> I don't have powerpoint here to try anything but.....
>
> Preventing recursion is fairly easy. For example, this recurses to the
point
> of no return....
> '=================
> Private Sub Form_Resize()
> Debug.Print "'Form1:Form_Resize", Timer
> Me.Width = Me.Width - 15
> End Sub
> '=================
>
> Adding a simple static flag gets rid of the problem. You'll see the
> Debug.Print line only once (until you resize again)
> '=================
> Private Sub Form_Resize()
> Static bAlreadyHere As Boolean
>
> If Not bAlreadyHere Then
> bAlreadyHere = True
> Debug.Print "'Form1:Form_Resize", Timer
> Me.Width = Me.Width - 15
> bAlreadyHere = False
> End If
> End Sub
> '=================
>
> --
> Ken Halter - MS-MVP-VB - http://www.vbsight.com
> DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
> Please keep all discussions in the groups..
>
>


.


Loading