Results 1 to 23 of 23

Thread: send message problem

Hybrid View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: send message problem

    Hey Tec

    This seems to work

    visual basic code:Me.Hide
    DoEvents
    gethwnd
    Me.Show



    It doesn't have time to hide your application and set focus to the notepad or whatever application you expect to have focus. I think

    Thanks manavo, this cretainly fixes the reliability problem for using to notepad or to my copiled vb program.
    if MS word or a different project vbide window nothing pastes, but i will compile this now and test a lot more.

    thanks again

  2. #2
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: send message problem

    Quote Originally Posted by westconn1
    Thanks manavo, this cretainly fixes the reliability problem for using to notepad or to my copiled vb program.
    if MS word or a different project vbide window nothing pastes, but i will compile this now and test a lot more.

    thanks again
    You're welcome

    Actually I just tried Word and I couldn't get it to work either... Weird though, I expected it would


    Quote Originally Posted by Tec-Nico
    Hey Manavo! I owe you one


    Has someone helped you? Then you can Rate their helpful post.

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: send message problem

    hahaha

    the program i mainly wanted to use this with (which isn't on my computer) doesn't get the paste, like Word, can i try to sendmessage the listbox text, instead of using sendmessage paste, (bypass the clipboard) and what would be the sendmessage command to do it.

    p.

  4. #4
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: send message problem

    Well, the other option would be to use the WM_SETTEXT although that would cause all the data in that textbox (if it is a simple textbox or richtextbox at least) to be lost... I'll have to see if there is another way. SendKeys somes to mind although I don't think it's the best way...


    Has someone helped you? Then you can Rate their helpful post.

  5. #5
    Hyperactive Member Dmitri K's Avatar
    Join Date
    Sep 2002
    Location
    West Palm Beach, FL
    Posts
    444

    Re: send message problem

    Your sendmessage declaration is wrong, that's why it doesn't work, but the syntax is right.

    If you're using WM_, you must change sendmessage declaration. Last parameter (lParam as any) must be ByVal lParam As String.

    The modified sendmessage is often refered to as SendMessageByString

    Original sendmessage:
    Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

    Modified sendmessage:
    Public Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: send message problem

    dmitri

    Modified sendmessage:
    Public Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
    i changed my program to use the modified send message,

    it still pastes fine into notepad, but nothing pastes to msword

    thanks peter

  7. #7
    Hyperactive Member Dmitri K's Avatar
    Join Date
    Sep 2002
    Location
    West Palm Beach, FL
    Posts
    444

    Re: send message problem

    Hmm, maybe wm_settext doesn't work with msword.

    As far as I can think right now, keyb_event is your only option, but someone may know a way.

    Post the code if not a problem. I'll tinker with it.

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