memory could not be "written" when application terminates

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Geert-Pieter Hof

    memory could not be "written" when application terminates

    Hello,

    I have written an application in Visual Basic 6.0 Professional SP5 that
    reads data from an Excel workbook by using ADO. When I close the
    application, I get the error:

    'The instruction at "0x01b302bd " referenced memory at "0xb52ad202 ". The
    memory could not be "written"'

    - this only happens with the compiled exe (both P-code and native code), but
    not when I run the application in Visual Basic without compiling
    - this only happens if the application has read data from the Excel workbook
    - this happens with Windows 98se, Windows NT 4 and Windows XP

    I'm using the MS ActiveX Data Object 2.7 Library.

    Does someone has a clue what might cause the error?

    Thanks in advance,

    Geert-Pieter


  • Asperamanca

    #2
    Re: memory could not be "written&q uot; when application terminates

    "Geert-Pieter Hof" <g.p.m.hof@wbmt .tudelft.nl.bla blabla> wrote in message news:<bilsfa$ff e$1@azure.qinip .net>...[color=blue]
    > Hello,
    >
    > I have written an application in Visual Basic 6.0 Professional SP5 that
    > reads data from an Excel workbook by using ADO. When I close the
    > application, I get the error:
    >
    > 'The instruction at "0x01b302bd " referenced memory at "0xb52ad202 ". The
    > memory could not be "written"'
    >
    > - this only happens with the compiled exe (both P-code and native code), but
    > not when I run the application in Visual Basic without compiling
    > - this only happens if the application has read data from the Excel workbook
    > - this happens with Windows 98se, Windows NT 4 and Windows XP
    >
    > I'm using the MS ActiveX Data Object 2.7 Library.
    >
    > Does someone has a clue what might cause the error?
    >
    > Thanks in advance,
    >
    > Geert-Pieter[/color]

    It is likely that there are some object references left which VB can't
    take care of. Try looking for circular references (Object A refers to
    Object B and vice versa, or something similar) and break them by
    explicitly setting the objects to Nothing. Note that Class_Terminate
    or Form_Terminate event won't arrive in such a case, so you have to
    remove the references earlier.

    Robert

    Comment

    • Geert-Pieter Hof

      #3
      Re: memory could not be &quot;written&q uot; when application terminates

      > I have written an application in Visual Basic 6.0 Professional SP5 that[color=blue]
      > reads data from an Excel workbook by using ADO. When I close the
      > application, I get the error:
      >
      > 'The instruction at "0x01b302bd " referenced memory at "0xb52ad202 ". The
      > memory could not be "written"'
      >
      > - this only happens if the application has read data from the Excel[/color]
      workbook

      Problem solved!

      The problem was a 3rd party component (Vertical Menu ActiveX Control from
      WinResources) that had to be set back to its initial state before closing
      the application. Altough this component has absolutely nothing to do with
      reading and writing the Excel workbook via ADO, the 'memory could not be
      "written"'-message only showed up after accessing the Excel workbook.

      One last question:
      The problem I had, is this an imperfection of the 3rd party component or of
      Visual Basic 6.0?

      Best regards,

      Geert-Pieter


      Comment

      • hex

        #4
        Re: memory could not be &quot;written&q uot; when application terminates

        "Geert-Pieter Hof" <g.p.m.hof@wbmt .tudelft.nl.bla blabla> wrote in message news:<bj1sui$qv 0$1@azure.qinip .net>...[color=blue][color=green]
        > > I have written an application in Visual Basic 6.0 Professional SP5 that
        > > reads data from an Excel workbook by using ADO. When I close the
        > > application, I get the error:
        > >
        > > 'The instruction at "0x01b302bd " referenced memory at "0xb52ad202 ". The
        > > memory could not be "written"'
        > >
        > > - this only happens if the application has read data from the Excel[/color]
        > workbook
        >
        > Problem solved!
        >
        > The problem was a 3rd party component (Vertical Menu ActiveX Control from
        > WinResources) that had to be set back to its initial state before closing
        > the application. Altough this component has absolutely nothing to do with
        > reading and writing the Excel workbook via ADO, the 'memory could not be
        > "written"'-message only showed up after accessing the Excel workbook.
        >
        > One last question:
        > The problem I had, is this an imperfection of the 3rd party component or of
        > Visual Basic 6.0?
        >
        > Best regards,
        >
        > Geert-Pieter[/color]

        We receive the same error from a similar application we have under
        development and using the same control from WinResources. I'd be very
        interested in what was done to eliminate this error. Any information
        you have regarding what you had to do to set the control back to its
        initial state would be of great help.

        Thanks in advance for your help,

        Andy

        Comment

        • Geert-Pieter Hof

          #5
          Re: memory could not be &quot;written&q uot; when application terminates

          > > > I have written an application in Visual Basic 6.0 Professional SP5
          that[color=blue][color=green][color=darkred]
          > > > reads data from an Excel workbook by using ADO. When I close the
          > > > application, I get the error:
          > > >
          > > > 'The instruction at "0x01b302bd " referenced memory at "0xb52ad202 ".[/color][/color][/color]
          The[color=blue][color=green][color=darkred]
          > > > memory could not be "written"'[/color][/color][/color]
          [color=blue][color=green]
          > > Problem solved!
          > >
          > > The problem was a 3rd party component (Vertical Menu ActiveX Control[/color][/color]
          from[color=blue][color=green]
          > > WinResources) that had to be set back to its initial state before[/color][/color]
          closing[color=blue][color=green]
          > > the application.[/color][/color]
          [color=blue]
          > We receive the same error from a similar application we have under
          > development and using the same control from WinResources. I'd be very
          > interested in what was done to eliminate this error. Any information
          > you have regarding what you had to do to set the control back to its
          > initial state would be of great help.[/color]

          Private Sub Form_Unload(Can cel As Integer)

          VerticalMenu1.M enuItemsMax = 0
          VerticalMenu1.M enusMax = 0

          End Sub

          Putting these two lines of code in the Form_Unload will prevent the memory
          could not be "written"-problem while unloading the Vertical Menu control.

          Best regards,

          Geert-Pieter


          Comment

          • hex

            #6
            Re: memory could not be &quot;written&q uot; when application terminates

            "Geert-Pieter Hof" <g.p.m.hof@wbmt .tudelft.nl.bla blabla> wrote in message news:<bjh90c$j9 5$1@azure.qinip .net>...[color=blue][color=green][color=darkred]
            > > > > I have written an application in Visual Basic 6.0 Professional SP5[/color][/color]
            > that[color=green][color=darkred]
            > > > > reads data from an Excel workbook by using ADO. When I close the
            > > > > application, I get the error:
            > > > >
            > > > > 'The instruction at "0x01b302bd " referenced memory at "0xb52ad202 ".[/color][/color]
            > The[color=green][color=darkred]
            > > > > memory could not be "written"'[/color][/color]
            >[color=green][color=darkred]
            > > > Problem solved!
            > > >
            > > > The problem was a 3rd party component (Vertical Menu ActiveX Control[/color][/color]
            > from[color=green][color=darkred]
            > > > WinResources) that had to be set back to its initial state before[/color][/color]
            > closing[color=green][color=darkred]
            > > > the application.[/color][/color]
            >[color=green]
            > > We receive the same error from a similar application we have under
            > > development and using the same control from WinResources. I'd be very
            > > interested in what was done to eliminate this error. Any information
            > > you have regarding what you had to do to set the control back to its
            > > initial state would be of great help.[/color]
            >
            > Private Sub Form_Unload(Can cel As Integer)
            >
            > VerticalMenu1.M enuItemsMax = 0
            > VerticalMenu1.M enusMax = 0
            >
            > End Sub
            >
            > Putting these two lines of code in the Form_Unload will prevent the memory
            > could not be "written"-problem while unloading the Vertical Menu control.
            >
            > Best regards,
            >
            > Geert-Pieter[/color]


            We'll add the code you have listed.

            Many thanks for the assistance!

            Andy

            Comment

            Working...