Results 1 to 5 of 5

Thread: Clipboard

  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
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Sendkeys "^v" should work
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    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

  4. #4

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

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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