VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Copy/Cut/Paste/Undo

T.R.  (1 Submission)   String Manipulation   Visual Basic 3.0   Beginner   Wed 3rd February 2021

I was just poking around this site, and noticed that a lot of folks were making the copy/paste/cut/undo functions more difficult then they really needs to be. Rather then writing your own functions, make use of the SendMessage API and let Windows do the work for you.

Assumes
To try out the code, simply create a form with a Richtextbox named Richtextbox1.

API Declarations
Private Const EM_UNDO = &HC7
Private Const WM_CUT = &H300
Private Const WM_COPY = &H301
Private Const WM_PASTE = &H302
Private Const WM_CLEAR = &H303
Private Const WM_UNDO = &H304
Private Declare Function SendMessage Lib _
"USER32.DLL" Alias "SendMessageA" _
(ByVal hWnd As Long, _
ByVal dwMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long

Rate Copy/Cut/Paste/Undo (5(5 Vote))
Copy/Cut/Paste/Undo.bas

Copy/Cut/Paste/Undo Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters