-
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!
-
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.