|
-
Mar 15th, 2001, 07:21 PM
#1
Thread Starter
Good Ol' Platypus
Code:
Function UNDO(hWnd As Long)
SendMessage hWnd, EM_UNDO, 0, 0
End Function
Function ToClip(hWnd As Long)
SendMessage hWnd, WM_COPY, 0, 0
End Function
Function FromClip(hWnd As Long)
SendMessage hWnd, WM_PASTE, 0, 0
End Function
Function CleanToClip(hWnd As Long)
SendMessage hWnd, WM_CUT, 0, 0
End Function
Okay... I have some problems with these.
When I call...
Undo - Just selects all the text.
ToClip - Works, but see FromClip (copy command)
FromClip - Pastes it TWICE. Error might be in ToClip when using that, or CleanToClip while using that(paste command)
CleanToClip - Works, but has same side-effects as ToClip when pasting back (see From Clip) (cut command)
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Mar 15th, 2001, 08:08 PM
#2
This all works for me.
Code:
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 WM_COPY = &H301
Private Const WM_CUT = &H300
Private Const WM_PASTE = &H302
Private Const WM_UNDO = &H304
Private Function Undo(hWnd As Long)
SendMessage hWnd, WM_UNDO, 0, 0
End Function
Private Function ToClip(hWnd As Long)
SendMessage hWnd, WM_COPY, 0, 0
End Function
Private Function FromClip(hWnd As Long)
SendMessage hWnd, WM_PASTE, 0, 0
End Function
Private Function CleanToClip(hWnd As Long)
SendMessage hWnd, WM_CUT, 0, 0
End Function
Private Sub Command1_Click()
ToClip Text1.hWnd
End Sub
Private Sub Command2_Click()
CleanToClip Text1.hWnd
End Sub
Private Sub Command3_Click()
Undo Text1.hWnd
End Sub
Private Sub Command4_Click()
FromClip Text1.hWnd
End Sub
-
Mar 15th, 2001, 09:24 PM
#3
Thread Starter
Good Ol' Platypus
Well... I'm using a RICHtextbox. Is it done differently for a rtb?
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Mar 15th, 2001, 09:49 PM
#4
Should work.
Code:
Private Sub Command1_Click()
ToClip RichTextBox1.hWnd
End Sub
Private Sub Command2_Click()
CleanToClip RichTextBox1.hWnd
End Sub
Private Sub Command3_Click()
Undo RichTextBox1.hWnd
End Sub
Private Sub Command4_Click()
FromClip RichTextBox1.hWnd
End Sub
-
Mar 15th, 2001, 10:41 PM
#5
Do you have any other code associated with copy/pasting that may influence this code?
-
Mar 16th, 2001, 10:10 PM
#6
use EM_CANUNDO and see if undoing is allowed. If you are accessing someone else's window, they might not allow it.
-
Mar 16th, 2001, 10:37 PM
#7
Here is the constant for it.
Code:
Private Const EM_CANUNDO = &HC6
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|