Results 1 to 5 of 5

Thread: Sendmessage to Notepad

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2001
    Posts
    6

    Post Sendmessage to Notepad

    Should be simple enough, but i cant get it to work. First time using API.

    Im trying to send text to a Notepad window. Code is below:

    ---
    winHwnd = FindWindow(vbNullString, "notepad.txt - Notepad")
    If winHwnd <> 0 Then
    msgbox "found"
    SendMessage winHwnd, WM_SETTEXT, 0, "hello"
    end if
    ---

    It finds the proper window, hence I get "found" in a msgbox.
    But it does not send the "hello" to the Notepad.

    What am i doing wrong? Sample code would be appreciated. Thanx.

  2. #2
    Member
    Join Date
    Sep 2001
    Location
    Nashville, Tennessee, USA
    Posts
    35
    I believe you need to (to put it in VB Terims) find the Textbox inside the Notepad form. Your writing to the Form not the editable part =)

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2001
    Posts
    6
    alright.. but how do i go on about doing that? Sample code anyone? =)

  4. #4
    TheSarlacc
    Guest
    altho it isnt an API call, ues AppActivate to switch to notepad once u have found the window. just a sugestion.

  5. #5

    Thread Starter
    New Member
    Join Date
    Apr 2001
    Posts
    6
    that would work if im going to use Sendkeys. But thats not what im after, i would like to send keystrokes to notepad without it being the active app. In other words i would be working on the comp on a different application while my VB prog sends keys to notepad in the background.

    I looked all over the vbforums and vb-world examples but couldnt come up with something that would work.. except for one example that closes the notepad window.


    still looking for help

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