Re: Problems with VB6 activex in PowerPoint



"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..


.



Relevant Pages

  • Re: Problems with VB6 activex in PowerPoint
    ... the recursion were being generated by my VB code, ... Normally I don't handle the Resize ... On my particular machine and PowerPoint version, ... > Static bAlreadyHere As Boolean ...
    (microsoft.public.vb.com)
  • Re: vertical-only resizing?
    ... >I have need to allow for vertical resizing of a form, ... Private mfWidth As Single ... Private Sub Form_Resize ... Static bAlreadyHere As Boolean ...
    (microsoft.public.vb.general.discussion)
  • Re: Cell sizing in a Vlookup formula to fit information.
    ... Could you resize all the usedrange's rowheights each time excel recalculates? ... Option Explicit ... Private Sub Worksheet_Calculate ... Is it possible for a cell to automatically size itself by height to fit the ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Out of Stack Space run-time error 28 in VB6 recursive
    ... Private Sub Check1_Click ... 'Your recursive code here ... Static bAlreadyHere As Boolean ...
    (microsoft.public.vb.general.discussion)
  • Re: UserControl: resizing textbox issue
    ... > Can you resize the UserControl in it's resizeevent handler? ... Private Sub UserControl_Resize ... ...Subtracting 1 or 2 won't do a thing if your scalemode's set to Twips. ...
    (microsoft.public.vb.general.discussion)

Loading