CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 1999
    Location
    Ohio, USA
    Posts
    163

    Attempted to read or write protected memory error

    I have several visual basic 2010 programs. One of the programs I have installed the program on four different windows 7 computers. I get the following error on one of the computers. Then another program I have installed it on 8 computers and I get the same error on 6 of the computers. Here is the error message I get:

    2011-10-11 06:19:04 , Main, -2147467261, Attempted to read or write protected memory. This is often an indication that other memory is corrupt., at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
    at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
    at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
    at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
    at System.Windows.Forms.Application.RunDialog(Form form)
    at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
    at System.Windows.Forms.Form.ShowDialog()
    at Molding.modMain.Main() in C:\Users\user\Documents\Visual Studio 2010\Line Side Labeling\Toota\051 Radiator\GB-Final\modMain.vb:line 198

    So far I have disabled DEP, turned off antivirus, turned off firewall and nothing has worked. I leave the program open on the weekend and the program doesn’t even do anything and I still get the error. Does anybody know how to fix this problem?

  2. #2
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Attempted to read or write protected memory error

    Show us the Code around the line that errors ( Line 198 in modMain.vb) .. It sounds like you may be trying to open a dialog with invalid settings..
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  3. #3
    Join Date
    Mar 1999
    Location
    Ohio, USA
    Posts
    163

    Post Re: Attempted to read or write protected memory error

    Here is the code arround line 198:

    Code:
                frmPartSelect.ShowDialog()
    
                If strSelectedShort <> "CANCEL" Then
                    frmMain.ShowDialog()
                End If
    line 198 is:

    frmMain.ShowDialog()

  4. #4
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Attempted to read or write protected memory error

    I think it may be an issue of Form ownership..
    MSDN article

    your Main Form should be your Base form and be the Owner of all subsequent Dialog forms. and not be owned by any of them..
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured