|
-
Jun 26th, 2000, 03:48 AM
#1
Thread Starter
Lively Member
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
-
Jun 26th, 2000, 03:33 PM
#2
Monday Morning Lunatic
I've noticed from quite a few posts around here that people are having trouble with playing around with another window's controls. Anyway, how did you obtain the handle to the control? Did you use something (similar to FindWindow?) to do this at runtime or did you just code it in? 
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 27th, 2000, 03:15 AM
#3
Thread Starter
Lively Member
I used FindWindowEx and FindWindow API Below
-----
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
-----
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal Hwnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Sample use start up your Calculator Program and run the code below.
dim win1 as long
Win1& = FindWindow(vbNullString,"Calculator") 'Gets the hWnd of the Calc's window
dim win1 as long
Win1& = FindWindowEx(0&,0&,vbNullString,"Calculator") 'Gets the hWnd of the Calc's window
This only gets the main windows hWnd, I mainly use FindEindowEx to get Child window hWnd's
Hope this helps, Need any more info Post again or just e-mail me and Ill be glad to help.
Jeremy
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
|