我做了一个组合控件,其上有两个msflexgrid(msFlexGrid和msFlexFix),5个image控件和3个label控件,还有两个picturebox,不知道为什么,设计时控件一点问题都没有,但是在运行时只要在除了叫msFlexGrid控件之上单击就出现如下的错误,
0x00100006指令引用的"0x00100006"内存。该内存不能为"read"
0x021202c0指令引用的0x00000020内存。该内存不能为written这种类似的问题我已经遇到多次了,但一直找到真正的原因,请各位大侠快快救我。
感恩不尽!!

解决方案 »

  1.   

    API调用错误或者有错误的内存操作,可能是你的汇编代码或者CallWindowProc错误使用造成的
      

  2.   

    to  thirdapple(陨落雕) :我没有进行内存操作呀,也没有调用汇编(我说的汇编是出现如上错误上,点击取消按钮后进入的调试界面是一堆汇编代码),也没有自己写WindowProc
    unhandled exception in VB6.EXE:0x0000005:Access Violation.
      

  3.   

    to HitXU(一天不学习,赶不上刘少奇) :我用的是VB,又何来指针???
      

  4.   

    首先VB是真正的地址指针传值你出现的问题和你的程序无关
    你是不是装vc或其他带程序调试的软件了?
    你得杀毒软件是什么?
    还有没有程序钩子?你的问题应该是上述原因引起的,把上述某些可疑服务关掉,再试试,应该没问题
      

  5.   

    你用API函数了么?
    你想想
      

  6.   

    to all:
    1.我装VC了(我用的是Visual Studio 6.0企业版(正版))
    2.杀毒软件是Norton
    3.我没有程序钩子
    4.我没有使用API函数
    5.当映射了TextBox控件的Change事件以及任何控件的Click,Double Click事件时最容易出现这种问题
    6.今天突然发现这种问题有时候在将使用该控件的程序编程成exe文件后便会消失最后,谢谢各位!!!
    不过我真的还没有找到真正的原因,我回去后会试一试各位给我提的建议的。
      

  7.   

    谢谢大家,请大家到以下地方去报个名吧(每贴均100分,此五贴合计五百分)
    http://expert.csdn.net/Expert/topic/2169/2169644.xml?temp=.1301996
    http://expert.csdn.net/Expert/topic/2169/2169645.xml?temp=.7696039
    http://expert.csdn.net/Expert/topic/2169/2169647.xml?temp=.7930414
    http://expert.csdn.net/Expert/topic/2169/2169642.xml?temp=.9176752
      

  8.   

    建议安装vbSp5
    还有就是你的代码问题或系统问题
      

  9.   

    新发现(有时即使把使用这个控件的Project编译成了Exe文件也会出现上述的问题)代码如下:
    Option Explicit
    'Default Property Values:
    Const m_def_ButtonPosition = 0
    'Property Variables:
    Dim m_ButtonPosition As Long
    'Event Declarations:
    Event Click() 'MappingInfo=msFlexGrid,msFlexGrid,-1,Click
    Event DblClick() 'MappingInfo=msFlexGrid,msFlexGrid,-1,DblClick
    Event KeyDown(KeyCode As Integer, Shift As Integer) 'MappingInfo=msFlexGrid,msFlexGrid,-1,KeyDown
    Event KeyPress(KeyAscii As Integer) 'MappingInfo=msFlexGrid,msFlexGrid,-1,KeyPress
    Event KeyUp(KeyCode As Integer, Shift As Integer) 'MappingInfo=msFlexGrid,msFlexGrid,-1,KeyUp
    Event MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) 'MappingInfo=msFlexGrid,msFlexGrid,-1,MouseDown
    Event MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single) 'MappingInfo=msFlexGrid,msFlexGrid,-1,MouseMove
    Event MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) 'MappingInfo=msFlexGrid,msFlexGrid,-1,MouseUp
    Event EnterCell() 'MappingInfo=msFlexGrid,msFlexGrid,-1,EnterCell
    Event LeaveCell() 'MappingInfo=msFlexGrid,msFlexGrid,-1,LeaveCell
    Event RowColChange() 'MappingInfo=msFlexGrid,msFlexGrid,-1,RowColChange
    Event Validate(Cancel As Boolean) 'MappingInfo=msFlexGrid,msFlexGrid,-1,Validate
    'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,BackColor
    Public Property Get BackColor() As OLE_COLOR
        BackColor = msFlexGrid.BackColor
    End PropertyPublic Property Let BackColor(ByVal New_BackColor As OLE_COLOR)
        msFlexGrid.BackColor() = New_BackColor
        PropertyChanged "BackColor"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,ForeColor
    Public Property Get ForeColor() As OLE_COLOR
        ForeColor = msFlexGrid.ForeColor
    End PropertyPublic Property Let ForeColor(ByVal New_ForeColor As OLE_COLOR)
        msFlexGrid.ForeColor() = New_ForeColor
        PropertyChanged "ForeColor"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=UserControl,UserControl,-1,Enabled
    Public Property Get Enabled() As Boolean
        Enabled = UserControl.Enabled
    End PropertyPublic Property Let Enabled(ByVal New_Enabled As Boolean)
        UserControl.Enabled() = New_Enabled
        PropertyChanged "Enabled"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,Font
    Public Property Get Font() As Font
        Set Font = msFlexGrid.Font
    End PropertyPublic Property Set Font(ByVal New_Font As Font)
        Set msFlexGrid.Font = New_Font
        PropertyChanged "Font"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=UserControl,UserControl,-1,Refresh
    Public Sub Refresh()
        UserControl.Refresh
    End SubPrivate Sub imgPageDown_Click(Index As Integer)
    '
        PageDown
        
    End SubPrivate Sub imgPageUp_Click(Index As Integer)
    '
        PageUp
        
    End SubPrivate Sub msFlexGrid_Click()
        RaiseEvent Click
    End SubPrivate Sub msFlexGrid_DblClick()
        RaiseEvent DblClick
    End SubPrivate Sub msFlexGrid_KeyDown(KeyCode As Integer, Shift As Integer)
        RaiseEvent KeyDown(KeyCode, Shift)
    End SubPrivate Sub msFlexGrid_KeyPress(KeyAscii As Integer)
        RaiseEvent KeyPress(KeyAscii)
    End SubPrivate Sub msFlexGrid_KeyUp(KeyCode As Integer, Shift As Integer)
        RaiseEvent KeyUp(KeyCode, Shift)
    End SubPrivate Sub msFlexGrid_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
        RaiseEvent MouseDown(Button, Shift, x, y)
    End SubPrivate Sub msFlexGrid_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
        RaiseEvent MouseMove(Button, Shift, x, y)
    End Sub
      

  10.   

    Private Sub msFlexGrid_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
        RaiseEvent MouseUp(Button, Shift, x, y)
    End Sub'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,AddItem
    Public Sub AddItem(ByVal Item As String, Optional ByVal Index As Variant)
        msFlexGrid.AddItem Item, Index
    End Sub'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,BackColorBkg
    Public Property Get BackColorBkg() As Long
        BackColorBkg = msFlexGrid.BackColorBkg
    End PropertyPublic Property Let BackColorBkg(ByVal New_BackColorBkg As Long)
        msFlexGrid.BackColorBkg() = New_BackColorBkg
        PropertyChanged "BackColorBkg"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,BackColorFixed
    Public Property Get BackColorFixed() As Long
        BackColorFixed = msFlexGrid.BackColorFixed
    End PropertyPublic Property Let BackColorFixed(ByVal New_BackColorFixed As Long)
        msFlexGrid.BackColorFixed() = New_BackColorFixed
        PropertyChanged "BackColorFixed"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,BackColorSel
    Public Property Get BackColorSel() As Long
        BackColorSel = msFlexGrid.BackColorSel
    End PropertyPublic Property Let BackColorSel(ByVal New_BackColorSel As Long)
        msFlexGrid.BackColorSel() = New_BackColorSel
        PropertyChanged "BackColorSel"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=lblPrompt,lblPrompt,-1,Caption
    Public Property Get Caption() As String
        Caption = lblPrompt.Caption
    End PropertyPublic Property Let Caption(ByVal New_Caption As String)
        lblPrompt.Caption() = New_Caption
        PropertyChanged "Caption"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,CellHeight
    Public Property Get CellHeight() As Long
        CellHeight = msFlexGrid.CellHeight
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,CellLeft
    Public Property Get CellLeft() As Long
        CellLeft = msFlexGrid.CellLeft
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,CellPicture
    Public Property Get CellPicture() As Picture
        Set CellPicture = msFlexGrid.CellPicture
    End PropertyPublic Property Set CellPicture(ByVal New_CellPicture As Picture)
        Set msFlexGrid.CellPicture = New_CellPicture
        PropertyChanged "CellPicture"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,CellTop
    Public Property Get CellTop() As Long
        CellTop = msFlexGrid.CellTop
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,CellWidth
    Public Property Get CellWidth() As Long
        CellWidth = msFlexGrid.CellWidth
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,Clear
    Public Sub Clear()
        msFlexGrid.Clear
    End Sub'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,ColAlignment
    Public Property Get ColAlignment(ByVal Index As Long) As Integer
        ColAlignment = msFlexGrid.ColAlignment(Index)
    End PropertyPublic Property Let ColAlignment(ByVal Index As Long, ByVal New_ColAlignment As Integer)
        msFlexGrid.ColAlignment(Index) = New_ColAlignment
        PropertyChanged "ColAlignment"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,ColIsVisible
    Public Property Get ColIsVisible(ByVal Index As Long) As Boolean
        ColIsVisible = msFlexGrid.ColIsVisible(Index)
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,ColPos
    Public Property Get ColPos(ByVal Index As Long) As Long
        ColPos = msFlexGrid.ColPos(Index)
    End Property
    '
    ''WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    ''MappingInfo=msFlexGrid,msFlexGrid,-1,ColPosition
    'Public Property Get ColPosition(ByVal Index As Long) As Long
    '    ColPosition = msFlexGrid.ColPosition(Index)
    'End Property
    '
    'Public Property Let ColPosition(ByVal Index As Long, ByVal New_ColPosition As Long)
    '    msFlexGrid.ColPosition(Index) = New_ColPosition
    '    PropertyChanged "ColPosition"
    'End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,Cols
    Public Property Get Cols() As Long
        Cols = msFlexGrid.Cols
    End PropertyPublic Property Let Cols(ByVal New_Cols As Long)
        msFlexGrid.Cols() = New_Cols
        PropertyChanged "Cols"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,ColWidth
    Public Property Get ColWidth(ByVal Index As Long) As Long
        ColWidth = msFlexGrid.ColWidth(Index)
    End PropertyPublic Property Let ColWidth(ByVal Index As Long, ByVal New_ColWidth As Long)
        msFlexGrid.ColWidth(Index) = New_ColWidth
        PropertyChanged "ColWidth"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,ColData
    Public Property Get ColData(ByVal Index As Long) As Long
        ColData = msFlexGrid.ColData(Index)
    End PropertyPublic Property Let ColData(ByVal Index As Long, ByVal New_ColData As Long)
        msFlexGrid.ColData(Index) = New_ColData
        PropertyChanged "ColData"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=UserControl,UserControl,-1,ContainerHwnd
    Public Property Get ContainerHwnd() As Long
        ContainerHwnd = UserControl.ContainerHwnd
    End PropertyPrivate Sub msFlexGrid_EnterCell()
        RaiseEvent EnterCell
    End Sub'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,FillStyle
    Public Property Get FillStyle() As FillStyleSettings
        FillStyle = msFlexGrid.FillStyle
    End PropertyPublic Property Let FillStyle(ByVal New_FillStyle As FillStyleSettings)
        msFlexGrid.FillStyle() = New_FillStyle
        PropertyChanged "FillStyle"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,FixedAlignment
    Public Property Get FixedAlignment(ByVal Index As Long) As Integer
        FixedAlignment = msFlexGrid.FixedAlignment(Index)
    End PropertyPublic Property Let FixedAlignment(ByVal Index As Long, ByVal New_FixedAlignment As Integer)
        msFlexGrid.FixedAlignment(Index) = New_FixedAlignment
        PropertyChanged "FixedAlignment"
    End Property
      

  11.   

    'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,FixedCols
    Public Property Get FixedCols() As Long
        FixedCols = msFlexGrid.FixedCols
    End PropertyPublic Property Let FixedCols(ByVal New_FixedCols As Long)
        msFlexGrid.FixedCols() = New_FixedCols
        PropertyChanged "FixedCols"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,FixedRows
    Public Property Get FixedRows() As Long
        FixedRows = msFlexGrid.FixedRows
    End PropertyPublic Property Let FixedRows(ByVal New_FixedRows As Long)
        msFlexGrid.FixedRows() = New_FixedRows
        PropertyChanged "FixedRows"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,FocusRect
    Public Property Get FocusRect() As FocusRectSettings
        FocusRect = msFlexGrid.FocusRect
    End PropertyPublic Property Let FocusRect(ByVal New_FocusRect As FocusRectSettings)
        msFlexGrid.FocusRect() = New_FocusRect
        PropertyChanged "FocusRect"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,ForeColorFixed
    Public Property Get ForeColorFixed() As Long
        ForeColorFixed = msFlexGrid.ForeColorFixed
    End PropertyPublic Property Let ForeColorFixed(ByVal New_ForeColorFixed As Long)
        msFlexGrid.ForeColorFixed() = New_ForeColorFixed
        PropertyChanged "ForeColorFixed"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,ForeColorSel
    Public Property Get ForeColorSel() As Long
        ForeColorSel = msFlexGrid.ForeColorSel
    End PropertyPublic Property Let ForeColorSel(ByVal New_ForeColorSel As Long)
        msFlexGrid.ForeColorSel() = New_ForeColorSel
        PropertyChanged "ForeColorSel"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,FormatString
    Public Property Get FormatString() As String
        FormatString = msFlexGrid.FormatString
    End PropertyPublic Property Let FormatString(ByVal New_FormatString As String)
        msFlexGrid.FormatString() = New_FormatString
        PropertyChanged "FormatString"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,GridColor
    Public Property Get GridColor() As Long
        GridColor = msFlexGrid.GridColor
    End PropertyPublic Property Let GridColor(ByVal New_GridColor As Long)
        msFlexGrid.GridColor() = New_GridColor
        PropertyChanged "GridColor"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,GridColorFixed
    Public Property Get GridColorFixed() As Long
        GridColorFixed = msFlexGrid.GridColorFixed
    End PropertyPublic Property Let GridColorFixed(ByVal New_GridColorFixed As Long)
        msFlexGrid.GridColorFixed() = New_GridColorFixed
        PropertyChanged "GridColorFixed"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,GridLines
    Public Property Get GridLines() As GridLineSettings
        GridLines = msFlexGrid.GridLines
    End PropertyPublic Property Let GridLines(ByVal New_GridLines As GridLineSettings)
        msFlexGrid.GridLines() = New_GridLines
        PropertyChanged "GridLines"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,GridLinesFixed
    Public Property Get GridLinesFixed() As GridLineSettings
        GridLinesFixed = msFlexGrid.GridLinesFixed
    End PropertyPublic Property Let GridLinesFixed(ByVal New_GridLinesFixed As GridLineSettings)
        msFlexGrid.GridLinesFixed() = New_GridLinesFixed
        PropertyChanged "GridLinesFixed"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,GridLineWidth
    Public Property Get GridLineWidth() As Integer
        GridLineWidth = msFlexGrid.GridLineWidth
    End PropertyPublic Property Let GridLineWidth(ByVal New_GridLineWidth As Integer)
        msFlexGrid.GridLineWidth() = New_GridLineWidth
        PropertyChanged "GridLineWidth"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,HighLight
    Public Property Get HighLight() As HighLightSettings
        HighLight = msFlexGrid.HighLight
    End PropertyPublic Property Let HighLight(ByVal New_HighLight As HighLightSettings)
        msFlexGrid.HighLight() = New_HighLight
        PropertyChanged "HighLight"
    End PropertyPrivate Sub msFlexGrid_LeaveCell()
        RaiseEvent LeaveCell
    End Sub'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,MouseIcon
    Public Property Get MouseIcon() As Picture
        Set MouseIcon = msFlexGrid.MouseIcon
    End PropertyPublic Property Set MouseIcon(ByVal New_MouseIcon As Picture)
        Set msFlexGrid.MouseIcon = New_MouseIcon
        PropertyChanged "MouseIcon"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,MousePointer
    Public Property Get MousePointer() As MousePointerSettings
        MousePointer = msFlexGrid.MousePointer
    End PropertyPublic Property Let MousePointer(ByVal New_MousePointer As MousePointerSettings)
        msFlexGrid.MousePointer() = New_MousePointer
        PropertyChanged "MousePointer"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,MouseRow
    Public Property Get MouseRow() As Long
        MouseRow = msFlexGrid.MouseRow
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,MouseCol
    Public Property Get MouseCol() As Long
        MouseCol = msFlexGrid.MouseCol
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,RemoveItem
    Public Sub RemoveItem(ByVal Index As Long)
        msFlexGrid.RemoveItem Index
    End SubPrivate Sub msFlexGrid_RowColChange()
        RaiseEvent RowColChange
    End Sub'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,RightToLeft
    Public Property Get RightToLeft() As Boolean
        RightToLeft = msFlexGrid.RightToLeft
    End PropertyPublic Property Let RightToLeft(ByVal New_RightToLeft As Boolean)
        msFlexGrid.RightToLeft() = New_RightToLeft
        PropertyChanged "RightToLeft"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,RowHeight
    Public Property Get RowHeight(ByVal Index As Long) As Long
        RowHeight = msFlexGrid.RowHeight(Index)
    End PropertyPublic Property Let RowHeight(ByVal Index As Long, ByVal New_RowHeight As Long)
        msFlexGrid.RowHeight(Index) = New_RowHeight
        PropertyChanged "RowHeight"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,RowHeightMin
    Public Property Get RowHeightMin() As Long
        RowHeightMin = msFlexGrid.RowHeightMin
    End Property
      

  12.   

    Public Property Let RowHeightMin(ByVal New_RowHeightMin As Long)
        msFlexGrid.RowHeightMin() = New_RowHeightMin
        PropertyChanged "RowHeightMin"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,RowIsVisible
    Public Property Get RowIsVisible(ByVal Index As Long) As Boolean
        RowIsVisible = msFlexGrid.RowIsVisible(Index)
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,RowPos
    Public Property Get RowPos(ByVal Index As Long) As Long
        RowPos = msFlexGrid.RowPos(Index)
    End Property
    '
    ''WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    ''MappingInfo=msFlexGrid,msFlexGrid,-1,RowPosition
    'Public Property Get RowPosition(ByVal Index As Long) As Long
    '    RowPosition = msFlexGrid.RowPosition(Index)
    'End Property
    '
    'Public Property Let RowPosition(ByVal Index As Long, ByVal New_RowPosition As Long)
    '    msFlexGrid.RowPosition(Index) = New_RowPosition
    '    PropertyChanged "RowPosition"
    'End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,Rows
    Public Property Get Rows() As Long
        Rows = msFlexGrid.Rows
    End PropertyPublic Property Let Rows(ByVal New_Rows As Long)
        msFlexGrid.Rows() = New_Rows
        PropertyChanged "Rows"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,TextArray
    Public Property Get TextArray(ByVal Index As Long) As String
        TextArray = msFlexGrid.TextArray(Index)
    End PropertyPublic Property Let TextArray(ByVal Index As Long, ByVal New_TextArray As String)
        msFlexGrid.TextArray(Index) = New_TextArray
        PropertyChanged "TextArray"
    End Property
    '
    ''WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    ''MappingInfo=msFlexGrid,msFlexGrid,-1,TextMatrix
    'Public Property Get TextMatrix(ByVal Row As Long, ByVal Col As Long) As String
    '    TextMatrix = msFlexGrid.TextMatrix(Row, Col)
    'End Property
    '
    'Public Property Let TextMatrix(ByVal Row As Long, ByVal Col As Long, ByVal New_TextMatrix As String)
    '    msFlexGrid.TextMatrix(Row, Col) = New_TextMatrix
    '    PropertyChanged "TextMatrix"
    'End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,TextStyle
    Public Property Get TextStyle() As TextStyleSettings
        TextStyle = msFlexGrid.TextStyle
    End PropertyPublic Property Let TextStyle(ByVal New_TextStyle As TextStyleSettings)
        msFlexGrid.TextStyle() = New_TextStyle
        PropertyChanged "TextStyle"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,TextStyleFixed
    Public Property Get TextStyleFixed() As TextStyleSettings
        TextStyleFixed = msFlexGrid.TextStyleFixed
    End PropertyPublic Property Let TextStyleFixed(ByVal New_TextStyleFixed As TextStyleSettings)
        msFlexGrid.TextStyleFixed() = New_TextStyleFixed
        PropertyChanged "TextStyleFixed"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=lblPrompt,lblPrompt,-1,UseMnemonic
    Public Property Get UseMnemonic() As Boolean
        UseMnemonic = lblPrompt.UseMnemonic
    End PropertyPublic Property Let UseMnemonic(ByVal New_UseMnemonic As Boolean)
        lblPrompt.UseMnemonic() = New_UseMnemonic
        PropertyChanged "UseMnemonic"
    End PropertyPrivate Sub msFlexGrid_Validate(Cancel As Boolean)
        RaiseEvent Validate(Cancel)
    End Sub'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MemberInfo=8,0,0,0
    Public Property Get ButtonPosition() As Long
        ButtonPosition = m_ButtonPosition
    End PropertyPublic Property Let ButtonPosition(ByVal New_ButtonPosition As Long)
        m_ButtonPosition = New_ButtonPosition
        PropertyChanged "ButtonPosition"
    End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MemberInfo=5
    Public Sub PageDown()
         
    End Sub'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MemberInfo=5
    Public Sub PageUp()
         
    End Sub'Initialize Properties for User Control
    Private Sub UserControl_InitProperties()
        m_ButtonPosition = m_def_ButtonPosition
    End Sub
      

  13.   


    'Load property values from storage
    Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
    Dim Index As Integer    msFlexGrid.BackColor = PropBag.ReadProperty("BackColor", &HFFFFFF)
        msFlexGrid.ForeColor = PropBag.ReadProperty("ForeColor", &H80000008)
        UserControl.Enabled = PropBag.ReadProperty("Enabled", True)
        Set msFlexGrid.Font = PropBag.ReadProperty("Font", Ambient.Font)
        msFlexGrid.BackColorBkg = PropBag.ReadProperty("BackColorBkg", 16777215)
        msFlexGrid.BackColorFixed = PropBag.ReadProperty("BackColorFixed", 13099748)
        msFlexGrid.BackColorSel = PropBag.ReadProperty("BackColorSel", 14217457)
        lblPrompt.Caption = PropBag.ReadProperty("Caption", "标题")
        Set CellPicture = PropBag.ReadProperty("CellPicture", Nothing)
    'TO DO: The member you have mapped to contains an array of data.
    '   You must supply the code to persist the array.  A prototype
    '   line is shown next:
        msFlexGrid.ColAlignment(Index) = PropBag.ReadProperty("ColAlignment" & Index, 0)
    'TO DO: The member you have mapped to contains an array of data.
    '   You must supply the code to persist the array.  A prototype
    '   line is shown next:
    '    msFlexGrid.ColPosition(Index) = PropBag.ReadProperty("ColPosition" & Index, 0)
        msFlexGrid.Cols = PropBag.ReadProperty("Cols", 4)
    'TO DO: The member you have mapped to contains an array of data.
    '   You must supply the code to persist the array.  A prototype
    '   line is shown next:
        msFlexGrid.ColWidth(Index) = PropBag.ReadProperty("ColWidth" & Index, 0)
    'TO DO: The member you have mapped to contains an array of data.
    '   You must supply the code to persist the array.  A prototype
    '   line is shown next:
        msFlexGrid.ColData(Index) = PropBag.ReadProperty("ColData" & Index, 0)
        msFlexGrid.FillStyle = PropBag.ReadProperty("FillStyle", 0)
    'TO DO: The member you have mapped to contains an array of data.
    '   You must supply the code to persist the array.  A prototype
    '   line is shown next:
        msFlexGrid.FixedAlignment(Index) = PropBag.ReadProperty("FixedAlignment" & Index, 0)
        msFlexGrid.FixedCols = PropBag.ReadProperty("FixedCols", 0)
        msFlexGrid.FixedRows = PropBag.ReadProperty("FixedRows", 0)
        msFlexGrid.FocusRect = PropBag.ReadProperty("FocusRect", 0)
        msFlexGrid.ForeColorFixed = PropBag.ReadProperty("ForeColorFixed", 2147483666#)
        msFlexGrid.ForeColorSel = PropBag.ReadProperty("ForeColorSel", 8454016)
        msFlexGrid.FormatString = PropBag.ReadProperty("FormatString", "")
        msFlexGrid.GridColor = PropBag.ReadProperty("GridColor", 16777215)
        msFlexGrid.GridColorFixed = PropBag.ReadProperty("GridColorFixed", 16777215)
        msFlexGrid.GridLines = PropBag.ReadProperty("GridLines", 0)
        msFlexGrid.GridLinesFixed = PropBag.ReadProperty("GridLinesFixed", 2)
        msFlexGrid.GridLineWidth = PropBag.ReadProperty("GridLineWidth", 1)
        msFlexGrid.HighLight = PropBag.ReadProperty("HighLight", 2)
        Set MouseIcon = PropBag.ReadProperty("MouseIcon", Nothing)
        msFlexGrid.MousePointer = PropBag.ReadProperty("MousePointer", 0)
        msFlexGrid.RightToLeft = PropBag.ReadProperty("RightToLeft", False)
    'TO DO: The member you have mapped to contains an array of data.
    '   You must supply the code to persist the array.  A prototype
    '   line is shown next:
        msFlexGrid.RowHeight(Index) = PropBag.ReadProperty("RowHeight" & Index, 0)
        msFlexGrid.RowHeightMin = PropBag.ReadProperty("RowHeightMin", 0)
    'TO DO: The member you have mapped to contains an array of data.
    '   You must supply the code to persist the array.  A prototype
    '   line is shown next:
    '    msFlexGrid.RowPosition(Index) = PropBag.ReadProperty("RowPosition" & Index, 0)
        msFlexGrid.Rows = PropBag.ReadProperty("Rows", 10)
    'TO DO: The member you have mapped to contains an array of data.
    '   You must supply the code to persist the array.  A prototype
    '   line is shown next:
        msFlexGrid.TextArray(Index) = PropBag.ReadProperty("TextArray" & Index, "")
    'TO DO: The member you have mapped to contains an array of data.
    '   You must supply the code to persist the array.  A prototype
    '   line is shown next:
    '    msFlexGrid.TextMatrix(Row, Col) = PropBag.ReadProperty("TextMatrix" & Index, "")
        msFlexGrid.TextStyle = PropBag.ReadProperty("TextStyle", 0)
        msFlexGrid.TextStyleFixed = PropBag.ReadProperty("TextStyleFixed", 0)
        lblPrompt.UseMnemonic = PropBag.ReadProperty("UseMnemonic", True)
        m_ButtonPosition = PropBag.ReadProperty("ButtonPosition", m_def_ButtonPosition)
        msFlexGrid.SelectionMode = PropBag.ReadProperty("SelectionMode", 1)
    End Sub'Write property values to storage
    Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
    Dim Index As Integer    Call PropBag.WriteProperty("BackColor", msFlexGrid.BackColor, &HFFFFFF)
        Call PropBag.WriteProperty("ForeColor", msFlexGrid.ForeColor, &H80000008)
        Call PropBag.WriteProperty("Enabled", UserControl.Enabled, True)
        Call PropBag.WriteProperty("Font", msFlexGrid.Font, Ambient.Font)
        Call PropBag.WriteProperty("BackColorBkg", msFlexGrid.BackColorBkg, 16777215)
        Call PropBag.WriteProperty("BackColorFixed", msFlexGrid.BackColorFixed, 13099748)
        Call PropBag.WriteProperty("BackColorSel", msFlexGrid.BackColorSel, 14217457)
        Call PropBag.WriteProperty("Caption", lblPrompt.Caption, "标题")
        Call PropBag.WriteProperty("CellPicture", CellPicture, Nothing)
    'TO DO: The member you have mapped to contains an array of data.
    '   You must supply the code to persist the array.  A prototype
    '   line is shown next:
        Call PropBag.WriteProperty("ColAlignment" & Index, msFlexGrid.ColAlignment(Index), 0)
    'TO DO: The member you have mapped to contains an array of data.
    '   You must supply the code to persist the array.  A prototype
    '   line is shown next:
    '    Call PropBag.WriteProperty("ColPosition" & Index, msFlexGrid.ColPosition(Index), 0)
        Call PropBag.WriteProperty("Cols", msFlexGrid.Cols, 4)
    'TO DO: The member you have mapped to contains an array of data.
    '   You must supply the code to persist the array.  A prototype
    '   line is shown next:
        Call PropBag.WriteProperty("ColWidth" & Index, msFlexGrid.ColWidth(Index), 0)
    'TO DO: The member you have mapped to contains an array of data.
    '   You must supply the code to persist the array.  A prototype
    '   line is shown next:
        Call PropBag.WriteProperty("ColData" & Index, msFlexGrid.ColData(Index), 0)
        Call PropBag.WriteProperty("FillStyle", msFlexGrid.FillStyle, 0)
    'TO DO: The member you have mapped to contains an array of data.
    '   You must supply the code to persist the array.  A prototype
    '   line is shown next:
        Call PropBag.WriteProperty("FixedAlignment" & Index, msFlexGrid.FixedAlignment(Index), 0)
        Call PropBag.WriteProperty("FixedCols", msFlexGrid.FixedCols, 0)
        Call PropBag.WriteProperty("FixedRows", msFlexGrid.FixedRows, 0)
        Call PropBag.WriteProperty("FocusRect", msFlexGrid.FocusRect, 0)
        Call PropBag.WriteProperty("ForeColorFixed", msFlexGrid.ForeColorFixed, 2147483666#)
        Call PropBag.WriteProperty("ForeColorSel", msFlexGrid.ForeColorSel, 8454016)
        Call PropBag.WriteProperty("FormatString", msFlexGrid.FormatString, "")
        Call PropBag.WriteProperty("GridColor", msFlexGrid.GridColor, 16777215)
        Call PropBag.WriteProperty("GridColorFixed", msFlexGrid.GridColorFixed, 16777215)
        Call PropBag.WriteProperty("GridLines", msFlexGrid.GridLines, 0)
        Call PropBag.WriteProperty("GridLinesFixed", msFlexGrid.GridLinesFixed, 2)
        Call PropBag.WriteProperty("GridLineWidth", msFlexGrid.GridLineWidth, 1)
        Call PropBag.WriteProperty("HighLight", msFlexGrid.HighLight, 2)
        Call PropBag.WriteProperty("MouseIcon", MouseIcon, Nothing)
        Call PropBag.WriteProperty("MousePointer", msFlexGrid.MousePointer, 0)
        Call PropBag.WriteProperty("RightToLeft", msFlexGrid.RightToLeft, False)
      

  14.   

    'TO DO: The member you have mapped to contains an array of data.
    '   You must supply the code to persist the array.  A prototype
    '   line is shown next:
        Call PropBag.WriteProperty("RowHeight" & Index, msFlexGrid.RowHeight(Index), 0)
        Call PropBag.WriteProperty("RowHeightMin", msFlexGrid.RowHeightMin, 0)
    'TO DO: The member you have mapped to contains an array of data.
    '   You must supply the code to persist the array.  A prototype
    '   line is shown next:
    '    Call PropBag.WriteProperty("RowPosition" & Index, msFlexGrid.RowPosition(Index), 0)
        Call PropBag.WriteProperty("Rows", msFlexGrid.Rows, 10)
    'TO DO: The member you have mapped to contains an array of data.
    '   You must supply the code to persist the array.  A prototype
    '   line is shown next:
        Call PropBag.WriteProperty("TextArray" & Index, msFlexGrid.TextArray(Index), "")
    'TO DO: The member you have mapped to contains an array of data.
    '   You must supply the code to persist the array.  A prototype
    '   line is shown next:
    '    Call PropBag.WriteProperty("TextMatrix" & Index, msFlexGrid.TextMatrix(Row, Col), "")
        Call PropBag.WriteProperty("TextStyle", msFlexGrid.TextStyle, 0)
        Call PropBag.WriteProperty("TextStyleFixed", msFlexGrid.TextStyleFixed, 0)
        Call PropBag.WriteProperty("UseMnemonic", lblPrompt.UseMnemonic, True)
        Call PropBag.WriteProperty("ButtonPosition", m_ButtonPosition, m_def_ButtonPosition)
        Call PropBag.WriteProperty("SelectionMode", msFlexGrid.SelectionMode, 1)
    End Sub'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=msFlexGrid,msFlexGrid,-1,SelectionMode
    Public Property Get SelectionMode() As SelectionModeSettings
        SelectionMode = msFlexGrid.SelectionMode
    End PropertyPublic Property Let SelectionMode(ByVal New_SelectionMode As SelectionModeSettings)
        msFlexGrid.SelectionMode() = New_SelectionMode
        PropertyChanged "SelectionMode"
    End Property
    以上既为所有代码,全部由ActiveX Wizard工具产生,该组合控件上共有如下控件:picMask(picture box),picBig(picture box,在picMask之内),msFlexGrid(在picBig之内),msFlexFix(MS FlexGrid),另外还有9个Image控件,3个Label控件。
    谢谢大家!!!
      

  15.   

    to huang_yi_cn(蓝色的云) :
    你遇到的情况跟我以前也很类似。我的是这样:
    当我打开一个软件的时候,没有多久,它就出现“该内存不能为read",然后跟你的一模一样。
    后来我是这样解决的:
    重装了使用的软件,先要彻底清除注册表中的信息,
    如果还不行的话,就只有重装系统了
    希望你能够快点解决~~~
    关注……
      

  16.   

    宣宾夺主一下~!!我做了个控件,只有一个button,然后生成.ocx~!注册的时候,错误:找不到入口~!怎么回事啊?谁能分析分析~!!
      

  17.   

    我想首先要分析是代码的原因还是环境的原因。
    (1)将这个控件编译后拿到别的机上运行看看,试多几台,如果同样有问题,那就是代码的问题了;
    (2)如果在其他机上运行正常,就是代码的问题了。如果是代码的问题,请在你的控件中加一个调试窗体,把工程属性设为“标准exe”,把你的控件加入到调试窗口中运行看看,一般VB出错时会停在出错的语句上,知道在那一句代码处有问题,就好办很多了。还有,你所用的第三方控件,单个使用时是否正常呢?
      

  18.   

    终于看完了全部代码,用工具生成的东西就是加这么多无用的注释。
    如果我没有看走眼的话,只有msFlexGrid进行了click事件触发。其他的控件没有进行click事件触发,问题是否出在这里,你可以给所有的控件都加入click事件触发试试。
    Private Sub msFlexGrid_Click()
        RaiseEvent Click
    End Sub
    Private Sub picMask_Click()
        RaiseEvent Click
    End Sub
    Private Sub picBig_Click()
        RaiseEvent Click
    End Sub
    ……
    如果你不想触发其他控件的click事件,请把 usercontrol.keypiveiew设为true试试,如果不行,请把 usercontrol.keypiveiew设为false也试试。