Results 1 to 2 of 2

Thread: copy/past to notepad?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2004
    Posts
    21

    copy/past to notepad?

    Is it possible to copy/past my variables to an already opened notepad?
    If so, how should I do that?

  2. #2
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959
    VB Code:
    1. Option Explicit
    2. Private Const WM_SETTEXT    As Long = &HC
    3.  
    4. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _
    5.                                                                         ByVal wMsg As Long, _
    6.                                                                         ByVal wParam As Long, _
    7.                                                                         lParam As Any) As Long
    8. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, _
    9.                                                                       ByVal lpWindowName As String) As Long
    10. Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, _
    11.                                                                           ByVal hWnd2 As Long, _
    12.                                                                           ByVal lpsz1 As String, _
    13.                                                                           ByVal lpsz2 As String) As Long
    14.  
    15. Private Sub Command1_Click()
    16.  
    17. Dim sMsg    As String
    18. Dim retval  As Long
    19. Dim mretval As Long
    20.  
    21.     retval = FindWindow("notepad", vbNullString)
    22.     mretval = FindWindowEx(retval, 0&, "edit", vbNullString)
    23.     sMsg = Clipboard.GetText
    24.     SendMessage mretval, WM_SETTEXT, 0&, ByVal sMsg
    25.  
    26. End Sub

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