Results 1 to 3 of 3

Thread: Clipboard Api

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    ca, usa
    Posts
    91

    Question

    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
    [email protected]
    If its as simple as it sounds I guess I am not basic enough.

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    ca, usa
    Posts
    91
    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
    [email protected]
    If its as simple as it sounds I guess I am not basic enough.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width