Results 1 to 2 of 2

Thread: Copy & Paste, but mostly Undo

  1. #1

    Thread Starter
    Member
    Join Date
    May 1999
    Location
    San Jose, CA, USA
    Posts
    43

    Question

    Ok, I kinda remember how to copy and paste from and to the clipboard, but I'm going to ask here so I won't have to look it up. But mainly I want to know how to do Undos...

    so,
    -how do I do an undo and maybe a redo function?
    -and how do i copy and paste from and to the clipboard?

    thanks people!
    -_=Progrium=_-
    Progrium Software

    Using: VB 6 Pro

  2. #2
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ottawa,ON,Canada
    Posts
    217
    To copy to the Clipboard:
    Call Clipboard.SetText(Text1.SelText, vbCFText)

    To paste from the Clipboard:
    Text1.SelText = Clipboard.GetText(vbCFText)

    To use Undo:
    Code:
    'DECLARATIONS
    Private Const EM_CANUNDO As Long = &HC6
    Private Const EM_UNDO As Long = &HC7
    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
    
    'To call the undo method:
    Private Sub cmdUndo_Click()
       Dim lRetVal As Long
       
       lRetVal = SendMessage(Text1.hwnd, EM_CANUNDO, 0, ByVal 0)
       
       If lRetVal <> 0 Then
          Call SendMessage(Text1.hwnd, EM_UNDO, 0, ByVal 0)
       End If
    End Sub

    As for a multiple-level redo, I wish I could help you. I've been asking the same question for a long time now, and no one seems to be able to give me an answer.

    I hope this helps you though. However, from now on you should do just a little research on questions as simple as the Clipboard copy and paste. I mean all you have to do is look in the Object Browser in VB (press F2).

    Later.

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