-
I have a small program that "should" envoke the Paste command within another edit control, code is below.
Private Sub Command1_Click()
Clipboard.Clear 'Clears Clipboard
Clipboard.SetData Picture1.Picture 'Copys the Picture Into The ClipBoard
Call SendMessage(TxtBox&, WM_PASTE, 0, 2) 'TxtBox& is the hWnd of a richedit control and "envokes" the Paste Command.
End Sub
The Problem I am having is that it works within its self meaning it is only working within the same exe that it was made in but not other apps like wordpad.
Does anyone have another Idea how to do it or how to fix this code?
Thank you,
Jeremy
-
Sendkeys "^v" should work
-
Look up Clipboard.GetData and Clipboard.GetText.
Another thing, there are APIs for Clipboard events.
Code:
Private Declare Function OpenClipboard Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function EmptyClipboard Lib "user32" () As Long
Private Declare Function SetClipboardData Lib "user32" (ByVal wFormat As Long, ByVal hMem As Long) As Long
'if you have problems with this function add the Alias "SetClipboardDataA"
Private Declare Function CloseClipboard Lib "user32" () As Long
-
Thank You Both for replying I tried one way out and it worked but I would still rather go with api so I am going to try Nitro's way here real quick and see what happens
Thanx Again,
Jeremy
-
Actually Clipboard object can be used instead of Nitros code, but it's not too fast either, but anyway i think that's not the problem
Anyway you need to send you data to that app and Sendkeys would be the best way and ^v for the pasting command.