要恢复的操作是不固定的!!需要在内存中存储以前的操作。如何做呢?

解决方案 »

  1.   

    把所有的windows消息都揽下来,记录着。
      

  2.   

    rappercn(rapper) :把所有的windows消息都揽下来,记录着。没错~录个巨集!全局键盘HOOK,鼠标也要!!
    很麻烦~
      

  3.   

    //把所有的windows消息都揽下来,记录着windows系统应该不是这么实现的看看能否从shell扩展方面入手,今天太晚了,明天再来
      

  4.   

    Undo ?Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Const EM_CANUNDO = &HC6
    Private Const EM_UNDO = &HC7Private Sub Command1_Click()
    Dim i As Integer
    i = SendMessage(Text1.hwnd, EM_UNDO, 0, 0)
    End Sub
      

  5.   

    大部分操作用UNDO消息不可行。还是需要拦截消息……不过似乎不是VB能办到的。
      

  6.   

    Private Sub Undo()
        If m_Undolist.Count = 0 Then Exit Sub
        
        m_RedoList.Add m_curFX.Lines, m_curFX.FxName, m_curFX.ShuoMing, m_curFX.GrpID, m_curFX.ID
        Set m_curFX = Nothing
        
        Set m_curFX = New MyFx
        
        Dim tmpFX As MyFx
        Dim tmpLine As MyLine
        
        Set tmpFX = m_Undolist(m_Undolist.Count)
        
        With m_curFX
            .FxName = tmpFX.FxName
            .GrpID = tmpFX.GrpID
            .ID = tmpFX.ID
            .ShuoMing = tmpFX.ShuoMing
            
            For Each tmpLine In tmpFX.Lines
                .Lines.Add tmpLine.ptStart, tmpLine.ptEnd
            Next
            
        End With
        
        
        m_Undolist.Remove m_Undolist.Count
        
        'redraw
        DrawBackGround
        
        RefreshButtons
    End SubPrivate Sub Redo()
        If m_RedoList.Count = 0 Then Exit Sub
        m_Undolist.Add m_curFX.Lines, m_curFX.FxName, m_curFX.ShuoMing, m_curFX.GrpID, m_curFX.ID
        
        Set m_curFX = Nothing
        
        Set m_curFX = New MyFx
        
        Dim tmpFX As MyFx
        Dim tmpLine As MyLine
        
        Set tmpFX = m_RedoList(m_RedoList.Count)
        
        With m_curFX
            .FxName = tmpFX.FxName
            .GrpID = tmpFX.GrpID
            .ID = tmpFX.ID
            .ShuoMing = tmpFX.ShuoMing
            
            For Each tmpLine In tmpFX.Lines
                .Lines.Add tmpLine.ptStart, tmpLine.ptEnd
            Next
            
        End With
        
        
        m_RedoList.Remove m_RedoList.Count
        
        DrawBackGround
        
        RefreshButtons
    End SubPrivate Sub SaveUndoData()
        While m_RedoList.Count > 0
            m_RedoList.Remove m_RedoList.Count
        Wend
        
        If m_Undolist.Count = UNDO_STEP_COUNT Then m_Undolist.Remove 1 'Remove head
        
        m_Undolist.Add m_curFX.Lines, m_curFX.FxName, m_curFX.ShuoMing, m_curFX.GrpID, m_curFX.ID
        
        RefreshButtons
    End Sub
      

  7.   

    操作一步调用SaveUndodata恢复调用Undo
    重做调用Redo